Flutter docs
Default skin

Input

Through mouse or keyboard input content, it is the most basic form field wrapper.

When to use

  • A user input in a form field is needed.
  • A search input is required.

Examples

Basic usage

Basic usage example.

Variants

Variants of Input, there are four variants: outlined filled borderless and underlined.

Search box

Example of creating a search box by grouping a standard input with a search button.

TextArea

For multi-line input.

OTP

One time password input.

prefix and suffix

Add a prefix or suffix icons inside input. Note: The suffix prop for Input.Password is supported starting from version 5.27.0.

With clear icon

Input box with the remove icon, click the icon to delete everything.

= 5.10.0">Custom count logic

It is necessary to customize the counting ability in some scenarios (such as emoji length is counted as 1), which can be achieved through the count attribute. Use count.max attribute exceeds the limit of the native maxLength.

Focus

Focus with additional option.

Three sizes of Input

There are three sizes of an Input box: large (40px), medium (32px) and small (24px).

Compact Style

Use Space.Compact create compact style, See the Space.Compact documentation for more.

Search box with loading

Search loading when onSearch.

Autosizing the height to fit the content

autoSize prop for a textarea type of Input makes the height to automatically adjust based on the content. An option object can be provided to autoSize to specify the minimum and maximum number of lines the textarea will automatically adjust.

Format Tooltip Input

You can use the Input in conjunction with Tooltip component to create a Numeric Input, which can provide a good experience for extra-long content display.

Password box

Input type of password.

With character counting

Show character counting.

Status

Add status to Input with status, which could be error or warning.

Custom semantic dom styling

You can customize the semantic dom style of Input by passing objects/functions through classNames and styles.

Sizes

small, middle (the default), and large map to --cb-control-height-sm, --cb-control-height-md, and --cb-control-height-lg. Each is max() of a preferred step (--cb-control-height-base-*) and the active pointer floor, so a density scale can retune the ladder but never take a control under its floor. On a coarse pointer — a touch screen — --cb-control-floor becomes --cb-control-floor-coarse (2.75rem, 44px), so small and middle both reach 44px and large keeps its 48px, with no per-field CSS. A pointer that hovers keeps --cb-control-floor-fine (2rem, 32px).

API

Input, Input.TextArea, Input.Search, Input.Password, and Input.OTP are exported from @ceebee/ui/client.

Input

PropertyDescriptionTypeDefaultVersion
addonAfterThe label text displayed after (on the right side of) the input field, please use Space.Compact insteadReactNode-—
addonBeforeThe label text displayed before (on the left side of) the input field, please use Space.Compact insteadReactNode-—
allowClearWhether to show a clear icon to remove input contentboolean | { clearIcon: ReactNode, disabled?: boolean }-disabled: 6.4.0
borderedWhether has border style, please use variant insteadbooleantrue4.5.0
classNamesCustomize class for each semantic structure inside the component. Supports object or function.Record<SemanticDOM, string> | (info: { props })=> Record<SemanticDOM, string>-5.4.0
countCharacter count configCountConfig-5.10.0
defaultValueThe initial input contentstring-—
disabledWhether the input is disabledbooleanfalse-
idThe ID for inputstring-—
maxLengthThe maximum number of characters in Inputnumber-—
prefixThe prefix icon for the InputReactNode-—
showCountWhether to show character countboolean | { formatter: (info: { value: string, count: number, maxLength?: number }) => ReactNode }false4.18.0 info.value: 4.23.0
statusSet validation status'error' | 'warning'-4.19.0
stylesCustomize inline style for each semantic structure inside the component. Supports object or function.Record<SemanticDOM, CSSProperties> | (info: { props })=> Record<SemanticDOM, CSSProperties>-5.4.0
sizeThe size of the input box. Note: in the context of a form, the medium size is usedlarge | medium | small-—
suffixThe suffix icon for the InputReactNode-—
typeThe type of input, see: MDN( use Input.TextArea instead of type="textarea")stringtext—
valueThe input content valuestring-—
variantVariants of Inputoutlined | borderless | filled | underlinedoutlined5.13.0 | underlined: 5.24.0
onChangeCallback when user inputfunction(e)-—
onPressEnterThe callback function that is triggered when Enter key is pressedfunction(e)-—
onClearCallback when click the clear button() => void-5.20.0

Input.TextArea

PropertyDescriptionTypeDefaultVersion
autoSizeHeight auto size feature, can be set to true | false or an object { minRows: 2, maxRows: 6 }boolean | objectfalse—
classNamesCustomize class for each semantic structure inside the component. Supports object or function.Record<SemanticDOM, string> | (info: { props }) => Record<SemanticDOM, string>-5.4.0
stylesCustomize inline style for each semantic structure inside the component. Supports object or function.Record<SemanticDOM, CSSProperties> | (info: { props }) => Record<SemanticDOM, CSSProperties>-5.4.0

Input.Search

PropertyDescriptionTypeDefaultVersion
classNamesCustomize class for each semantic structure inside the component. Supports object or function.Record<SemanticDOM, string> | (info: { props }) => Record<SemanticDOM, string>-6.0.0
enterButtonfalse displays the default button color, true uses the primary color, or you can provide a custom button. Conflicts with addonAfter.ReactNodefalse—
loadingSearch box with loadingbooleanfalse—
onSearchThe callback function triggered when you click on the search-icon, the clear-icon or press the Enter keyfunction(value, event, { source: "input" | "clear" })-—
stylesCustomize inline style for each semantic structure inside the component. Supports object or function.Record<SemanticDOM, CSSProperties> | (info: { props }) => Record<SemanticDOM, CSSProperties>-6.0.0
searchIconCustomize the search iconReactNode-6.4.0
variantVariants of Inputoutlined | borderless | filled | underlinedoutlined5.13.0 | underlined: 5.24.0

Input.Password

PropertyDescriptionTypeDefaultVersion
classNamesSemantic DOM classRecord<SemanticDOM, string>-5.4.0
iconRenderCustom toggle button(visible) => ReactNode(visible) => (visible ? &lt;EyeOutlined /> : &lt;EyeInvisibleOutlined />)4.3.0
stylesSemantic DOM styleRecord<SemanticDOM, CSSProperties>-5.4.0
variantVariants of Inputoutlined | borderless | filled | underlinedoutlined5.13.0 | underlined: 5.24.0
visibilityToggleWhether show toggle button or control password visibleboolean | VisibilityToggletrue—

Input.OTP

PropertyDescriptionTypeDefaultVersion
autoCompleteThe autocomplete attribute for input elements, e.g. one-time-code for OTP autofillstring-6.3.0
classNamesCustomize class for each semantic structure inside the component. Supports object or function.Record<SemanticDOM, string> | (info: { props }) => Record<SemanticDOM, string>-6.0.0
defaultValueDefault valuestring-—
disabledWhether the input is disabledbooleanfalse—
formatterFormat display, blank fields will be filled with(value: string) => string-—
separatorrender the separator after the input box of the specified indexReactNode |((i: number) => ReactNode)-5.24.0
stylesCustomize inline style for each semantic structure inside the component. Supports object or function.Record<SemanticDOM, CSSProperties> | (info: { props }) => Record<SemanticDOM, CSSProperties>-6.0.0
maskCustom display, the original value will not be modifiedboolean | stringfalse5.17.0
lengthThe number of input elementsnumber6—
statusSet validation status'error' | 'warning'-—
sizeThe size of the input boxsmall | medium | largemedium—
variantVariants of Inputoutlined | borderless | filled | underlinedoutlinedunderlined: 5.24.0
valueThe input content valuestring-—
onChangeTrigger when all the fields are filled(value: string) => void-—
onInputTrigger when the input value changes(value: string[]) => void-5.22.0
tabIndexSet the tabIndex of the toggle buttonnumber06.5.0
visibleWhether the password is show or hidebooleanfalse4.24.0
onVisibleChangeCallback executed when visibility of the password is changed(visible) => void-4.24.0
blurRemove focus-——
focusGet focus(option?: { preventScroll?: boolean, cursor?: 'start' | 'end' | 'all' })option - 4.10.0—