Input: Controlled
onValueChange hands you the string directly, so there’s no event.target.value to unwrap. onChange still works too.
18/32
This adds the example as components/examples/input/controlled.tsx, together with the Input component and the HextaUI theme tokens it needs.
pnpm dlx shadcn@latest add https://hextaui.com/r/input-controlled.jsonTo add only the component, follow the Input installation.
Props in this example
The Input props this example sets, from the API reference.
| Prop | Type | Default |
|---|---|---|
value | string | number | string[] | – |
onValueChangeCalled with the new value on every change. | (value: string, details) => void | – |
Every prop is in the Input API reference.
- Sizes
- With a description
- Invalid
- Native validation
- Disabled
- Read only
- File
- Input types
- With a button
- Grid
- Long content
- Right to left
See them all, with keyboard support and accessibility notes, on the Input page.
- MotionThe easing curves, durations and reduced-motion check every component animates with, plus hooks for size morphs and sliding highlights.
- Number flowAnimated numbers where only the changed digits spin, with any Intl format and locale.
- useAutosizeGrows a textarea with what you write between its minimum and maximum height, animating each change without ever touching the text.
- useComposedRefKeeps a ref to your own element while still forwarding it to whatever ref the parent passed in.
- useInvalidShakeShakes a form control when a submit attempt finds it invalid, and never while someone is still typing.
- useMergedRefCombines any number of callback and object refs into one, with React 19 ref cleanup for each of them.