Input
Text Field
NewOne text field in seven looks, from a plain outline to an inset label, a pressed-in field and frosted glass.
npx motionsnack add text-fieldCustomize
Error Colour
Warning Colour
Success Colour
<TextField />Props
33 properties
| Property | Type | Default | Description |
|---|---|---|---|
| value | string | - | Controlled value. Leave undefined to let the component manage it. |
| defaultValue | string | '' | Value on first render when uncontrolled. |
| onChange | (value: string) => void | - | Called with the new text on every change. |
| name | string | - | Name submitted with a form. |
| autoComplete | string | from type | Native autocomplete hint. |
| inputMode | string | from type | Native virtual keyboard hint. |
| clearLabel | string | 'Clear text' | Accessible name of the clear button. |
| invalid | boolean | false | Invalid without its own message. |
| charactersLeftLabel | string | '{n} characters left' | Screen-reader counter text. |
| charactersOverLabel | string | '{n} characters too many.' | Error text past the limit. |
| id | string | generated | Id of the input. |
| className | string | '' | Extra classes on the wrapper. |
| variant | 'outline' | 'filled' | 'glass' | 'outline' | Look of the field: outline, filled (forms on cards) or glass (over imagery only). |
| label | string | 'Email' | Label above the field. Empty hides it; then pass aria-label. |
| placeholder | string | 'you@studio.com' | Hint inside the empty field. |
| helperText | string | 'We reply within one working day.' | Small text under the field. Empty hides it. |
| error | string | '' | Error message. Any text switches the field to its error state. |
| warning | string | '' | Warning message in the helper slot. Does not block submit. |
| success | boolean | false | Check at the end after an async check passed. |
| loading | boolean | false | Async check running: spinner at the end after 500ms. |
| icon | 'none' | 'mail' | 'user' | 'phone' | 'search' | 'link' | 'lock' | 'none' | Icon at the start of the field. |
| type | 'text' | 'email' | 'tel' | 'url' | 'password' | 'search' | 'number' | 'email' | Native input type. |
| required | boolean | false | Marks the field as required. |
| disabled | boolean | false | Disables the field. |
| readOnly | boolean | false | Focusable and selectable, but not editable. |
| clearable | boolean | false | Clear button while the field has a value. |
| maxLength | number | 0 | Character limit for the counter. 0 = no limit. |
| showCounter | boolean | false | Character counter from 85 % of the limit. |
| errorColor | string | '' | Error colour for both themes. Empty uses the per-theme pair. |
| warningColor | string | '' | Warning colour for both themes. Empty uses the per-theme pair. |
| successColor | string | '' | Success colour for both themes. Empty uses the per-theme pair. |
| height | number | 48 | Height of the field: 48, or 40 in filters, toolbars and table cells. |
| radius | number | 12 | Corner radius of the field. |
About Text Field
Text Field is the everyday input of a form, built once and dressed seven ways. Outline, filled, underline and pill cover the usual looks; inset puts a small label inside the top of the box like a payment form; inset shadow presses the field into the surface; glass blurs whatever lies behind it, for a field on a photo or a coloured banner. Every look shares the library's field size and the same clear focus outline, white on dark pages and black on light ones. A leading icon, helper text, a required mark and an error state that turns the border red are built in, and it works controlled or uncontrolled.
What's included
- Seven looks: outline, filled, underline, pill, inset label, inset shadow, glass
- Clear focus outline, white on dark and black on light
- Optional leading icon from 6 inline icons
- Helper text and required mark
- Error state with a red border and message
- Controlled and uncontrolled value
- Light and dark look
- Type
- Animated React input component
- Library
- Components · Input
- Stack
- Next.js, React, Tailwind CSS
- Added
- 2026-11-23
- Install
npx motionsnack add text-field