Usage
No props are required to display <TextInput>
, but it’s recommended to provide a label
for accessibility.
Help text
To display additional info beneath the input, pass in helpText
.
Choose a unique username.
Sizing
When displaying an input in a space-constrained location, you can pass small
, which decreases the padding and font size.
Choose a unique username.
Dark mode
To display the text input on a dark background, pass darkMode
.
Choose a unique username.
Errors
When displaying an error message, pass error
to highlight the input in red.
This username is already taken.
Placeholders
Placeholder text may be used to provide an example of input to the user.
Disabled
Icons
You can add icons to the left or right side of the input using iconLeft
or icon
props respectively.
Full Width
To make the input take up the full width of its container, use the fullWidth
prop.
Clearable
To add a clear button that appears when the input has a value, use the onClear
prop.
API Reference
TextInput
Inherits properties from HTMLInputElement
.
Prop | Type | Default |
---|---|---|
darkMode | boolean | false |
disabled | boolean | false |
error | boolean | false |
fullWidth | boolean | false |
helpText | string | |
icon | IconProp | |
iconLeft | IconProp | |
iconProps | Omit<FontAwesomeIconProps, 'icon'> | |
label | string | |
onClear | () => void | |
small | boolean | false |