Components / UI components / Forms
FormsExperimental alpha

Input

A native text input that composes with Field and application validation.

Input preview

This value is controlled by the local example.

Interactions use local sample data.

Usage and props

Use for a single-line form value. Wrap it in Field for a label, help text and an error, or connect a label with id and htmlFor. A placeholder does not replace a label. Validate submitted values on the server.

valuestring | number | readonly string[] (optional)
The controlled value. For a text field, keep a string in application state.
onChange(event: ChangeEvent<HTMLInputElement>) => void (optional)
Read event.currentTarget.value to update your controlled text value.
typeHTMLInputTypeAttribute (optional)
Defaults to text. Choose email, password or another native input type as needed.
namestring (optional)
The key used in native form data.
requiredboolean (optional)
Enables native required validation. Validate application rules separately.
disabledboolean (optional)
Blocks editing and excludes the input from native form submission.
How state and callbacks work

These are the main props for the example. The package's TypeScript declarations include the full API.

Customize and use with a keyboard