The TextInput wrapper component is used when you need to let users enter the text of some kind, such as their name or phone number etc.
All TextInput could include visible labels, placeholder, hint text. Also, all standard form attributes are supported e.g. required, disabled, readonly. Input inside TextInput wrapper component has a transparent background but could be configured by props.
TextInput comes with three sizes: medium, large and xLarge, which are configured by required prop inputSize. TextInput medium and large sizes have an outside label view, while TextInput xLarge size has an inner label view.
For mobile, the usage of respected keyboards is recommended, f.e. if it's likely that the user will need to enter a number and you want to bring up the numeric keypad on a mobile device.
The TextInput support a range of input formats, some of which include automatic browser validation. These can be set by providing HTML input type attributte.
Label
Label RTL
Without Label
Hint message
Informative message holder
Informative message holder
Informative message holder
Disabled
Informative message holder
Informative message holder
Informative message holder
Error
Error message
Error message
Error message
Input with background color
Informative message holder
Informative message holder
Informative message holder
Readonly
Informative message holder
Informative message holder
Informative message holder
Props for TextInput component
Name | Type | Required | Default | Description |
---|---|---|---|---|
inputSize | medium | large | xlarge | Yes | medium | Input size |
type | TextInputTypes | Yes | text | Different types of input |
label | JSX.Element | string | No | Required for medium size | |
placeholder | string | No | Placeholder for input | |
id | string | No | - | Set input id |
hintText | JSX.Element | string | No | Informative or error message under input | |
isError | boolean | No | Set error state for input | |
showPasswordText | JSX.Element | string | No | Only for input type password. Text for toggle button: show/hide password | |
backgroundColor | ColorProps | No | transparent | Background color |