Sajari UI

TextInput

TextInput component is a component that is used to get user input in a text field. It is usually used together with a FormControl to provide an accessible label, validation messages, etc.

Import

Usage

Here's a basic usage of the TextInput component.

Editable Example

Controlled Input

Editable Example

Invalid

Editable Example

Disabled

Editable Example

ReadOnly

Editable Example

Props

The Input component composes PseudoBox so you can pass all PseudoBox props, and React.InputHTMLAttributes.

NameTypeDefaultDescription
aria-labelstringAccessibility label to use, in scenarios where the input has no visible label. A11y: It's usefult for screen readers.
aria-describedbystringAccessibility label to use, in scenarios where the input has no visible label. A11y: It's usefult for screen readers.
disabledbooleanfalseIf true, the input will be disabled. This sets aria-disabled=true and you can style this state by passing _disabled prop.
invalidbooleanfalseIf true, the input will indicate an error. This sets aria-invalid=true and you can style this state by passing _invalid prop.
requiredbooleanfalseIf true, the input element will be required.
readOnlybooleanfalseIf true, prevents the value of the input from being edited.