Skip to main content

Text Input

Accepts variable amounts of freeform user input.

Examples

Default Text Input

<TextInput 
required
label="Label"
placeholder="Placeholder"
id="default-input"
size="small|medium(default)"
/>

With Helper Text

Helper Text
Helper Text
<TextInput 
...
helperText="Helper Text"
/>

With Critical, Warning, Success, and Disabled States

Some kind of error
Some kind of error
Some kind of warning
Some kind of warning
Some kind of success
Some kind of success
No touching!
No touching!
<TextInput 
...
state="critical|warning|success"
/>

With a Multiline Input

<TextInput 
...
multiline
rows="5"
/>

With Icons

<TextInput 
...
iconStart={"placeholder" | <Icon name="placeholder" />}
iconEnd={"placeholder" | <Icon name="placeholder" />}
/>

Controlled Text Input

<TextInput 
value={someValue}
onChange={(evt, value) => ...}
/>

Props

NameTypeDefault ValueRequiredDescription
fieldClassNamestringNoA className to apply to the field.
fieldPropsRecord<string, unknown>NoAny props to spread onto the field container.
helperTextReactNodeNoA string or component to display as helper text beneath the input
iconEndstring | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | ReactFragment | ReactPortal | nullNoAn icon to render at the end of the input.
iconStartstring | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | ReactFragment | ReactPortal | nullNoAn icon to render at the front of the input.
labelReactNodeNoA string or component to display as a label above the input
multilinebooleanfalseNoShould a textarea be used instead of an input?
onChangeFormControlChangeEventHandler<InputType, string | number | readonly string[] | (string | number | readonly string[])[]> | undefinedNoEmit a new value when the input's selected value changes.
requiredbooleanfalseNoIs the field required?
resizebooleanfalseNoCan the textarea be resized?
rowsstring | numberNoHow many rows call should the multiline input be?
size"small" | FormControlSize | "medium"FormControlSize.MediumNoThe size of the field
state"" | FormControlState | "critical" | "warning" | "success"FormControlState.DefaultNoThe state of the field

Enums

FormControlSize

KeyValue
Small"small"
Medium"medium"

FormControlState

KeyValue
Default""
Critical"critical"
Warning"warning"
Success"success"