Forms
Field
Label, hint and error around one form control, wired for screen readers. The base of Input, Select and Textarea.
- Experimental
- No keyboard interaction
- Screen reader not tested yet
Playground
Change the props. The controls come from the documented props.
The first day of the project.
<Field label="Start date" hint="The first day of the project.">
<input
type="date"
name="playground-start"
className="h-input-height rounded-input border border-control px-4"
/>
</Field>Usage
When to use
Use Field only to wrap a form control the system doesn't have yet, so it gets the same label, hint and error treatment as every other field. Report the missing control as a gap.
When not to use
- Around Input, Select or Textarea: they already contain a Field.
- For Checkbox and RadioGroup: they have their own label structure.
How it works
Field renders the label, the hint above the control and the error below it, and wires them up: the label points at the control, hint and error are linked with aria-describedby, and an error sets aria-invalid. optional adds “(optional)” to the label.
Content guidelines
Labels are short nouns. Hints say what a good answer looks like before people type. Errors say how to fix the problem, not only that there is one.
Do and don’t
Do
- Use it only for a control the system doesn't have yet, and report that gap.
Don’t
- Don't wrap Input, Select or Textarea in a Field; they already contain one.
Anatomy
The parts of the component and what each one does, as in the playground above.
- label14px medium; “(optional)” in text.secondary.
- hintAbove the control, so it is read before typing.
- input-fieldAny control, passed as the only child.
- error-messageIcon, “Error:” for screen readers, text in accent.
Examples
Type-checked, and the same code goes into the AI manifest. Import: import { Field } from "@/ds";
Around a native control
The first day of the project.
Props
Checked against the component's TypeScript type on every build.
| Name | Type | Default | Description |
|---|---|---|---|
| label (required) | string | – | Visible label. |
| hint | string | – | Help text between label and control. |
| error | string | – | Error message; sets aria-invalid on the control. |
| optional | boolean | false | Adds “(optional)” to the label. |
| children (required) | ReactElement | – | One control element; Field adds id, aria-describedby and aria-invalid. |
Tokens used
Derived from the utility classes in the component's source. Copy a class with one click.
| Token | Tier | Value | Utility |
|---|---|---|---|
| input.height | component | 48px | |
| input.radius | component | 8px | |
| accent.default | semantic | #C6492E | |
| border.control | semantic | #8A8578 | |
| spacing.2 | semantic | 8px | |
| spacing.4 | semantic | 16px | |
| text.primary | semantic | #0A0A0B | |
| text.secondary | semantic | #555555 | |
| type.small.size | semantic | 14px | |
| weight.medium | semantic | 500 | |
| weight.regular | semantic | 400 |
Accessibility
What is checked automatically on every build, and what a person has tested. Nothing is marked as tested unless it was.
| Check | How | Status |
|---|---|---|
| axe-core rules | Automated on every npm run check, at desktop and mobile width | Runs on every build |
| Keyboard | Automated Playwright test (scripts/keyboard.mjs) | Not applicable |
| Screen reader | Manual | Not tested yet |
Semantics and focus
- <label for> points at the control; hint and error are linked with aria-describedby.
- Errors carry an icon and text, never colour alone.