TextField
MoleculeThrive, no shadcn equivalentA single-line input with its label and one line of help or error.
components/molecules/text-field.tsx — Label + Input- Use it for
- Every single-line field on a form.
- Not for
- Long text (TextAreaField) or a choice from a fixed list (Select, RadioGroup).
States
This is how your name will show up in the system.
Enter a full email address.
Shown on your Kudo cards.
Shown on your Kudo cards.
Enter a full email address.
Usage
import { TextField } from '@/components/molecules/text-field';
<TextField
label="Full Name"
name="fullName"
autoComplete="name"
required
value={fullName}
onChange={(event) => setFullName(event.target.value)}
errorMessage={errors.fullName}
/>Props
| Prop | Type | Default | Description |
|---|---|---|---|
| label | string | — | Visible label, and the accessible name. Required. |
| helperText | string | — | One line of help under the control, read with it. |
| errorMessage | string | — | Replaces the helper text, turns it red and marks the control aria-invalid. |
| required | boolean | false | Adds the asterisk and the native required state. |
| variant | 'outlined' | 'filled' | 'standard' | 'outlined' | Outlined draws a border; filled sits on a light tint; standard on a solid grey. |
| size | 'sm' | 'md' | 'md' | md is a 44px control, sm a 32px one with smaller type. |
| ...rest | ComponentProps<'input'> (no id) | — | value/onChange, name, type, placeholder, autoComplete… The id is generated. |
Accessibility
- The label is a real <label>; clicking it focuses the input.
- Helper or error text is linked with aria-describedby, so it is read with the field.
- The asterisk is hidden from screen readers; “required” is announced instead.