Input
Fundamental component for inputs.
Pair with Field.* for label/description/error wiring in forms:
Validation States:
Or render the control on its own:
Examples
With TanStack Form
Use @tanstack/react-form with zod when the input needs controlled value, blur, submit, and validation state. Field.Item owns the field name and Field.Errors renders normalized validator messages.
Child elements
Compose additional visual or functional elements within the Input using children. The examples below show how to render start and end icons or buttons. The Password Input is built with this API under the hood! You must also pass the InputCapture component as children, because it renders the actual form input element! When you do not use the children API, Input renders an InputCapture for you.
When composing with interactive content (e.g. a button), consider whether that element should be tab-indexable or receive focus!
When to use InputCapture
For 90% of cases (a simple input with optional icons or validation), pass children directly to <Input> or omit children entirely. The Input renders an InputCapture for you internally, so you do not need to import or render it yourself.
InputCapture is the actual <input> element wrapper. Reach for it only when composing custom adornments: for example, a left-side prefix and a right-side suffix where the existing Input slots don't fit. When you supply your own children, you must include <InputCapture /> so the form input element is still rendered. The Password Input is built using this API under the hood.
API Reference
The Input accepts the following props in addition to the standard HTML input attributes.
Two standard attributes are narrowed to unions, so a typo is a type error: type accepts the native input type names, and autoComplete accepts the HTML autocomplete tokens.
InputCapture
The <input> element itself. Input renders one for you unless you pass children; then you render it yourself among your adornments. It accepts the same props as Input, minus children, and reads any prop you set on the surrounding Input through context, so id, name, type, validation, and the aria-* attributes land on the element whichever of the two you set them on.