Forms
Input
Single-line text field with an always visible label, optional hint and an error state.
- Ready
- Keyboard tested
- Screen reader not tested yet
Playground
As it appears on invoices.
<Input
label="Company"
name="playground-company"
hint="As it appears on invoices."
/>States
Error: Enter first and last name.
Usage
When to use
Use an input for a short, single-line answer: a name, an email address, a date, a number.
When not to use
- For answers longer than one line: use Textarea.
- For a choice out of known options: use Select or RadioGroup.
How it works
The label is always visible above the field; the hint sits between label and field, so it is read before typing. Use native types (email, tel, url, number) and autoComplete so browsers and phones help. An error shows an icon, text and an inset ring in the accent colour, without moving the layout.
Content guidelines
Labels are short nouns (“Email”, not “Please enter your email”). Never use the placeholder as the label: it disappears while typing. Errors say how to fix it: “Enter an email address in the format name@example.com.”
Do and don’t
DoRequired is the default; only the optional field is marked. Don’tEvery label marked as required: the marks add noise and hide the one field people may skip.
- Keep the label short and unambiguous.
- The error message says how to fix it.
- Don't use a placeholder as the label.
- Don't communicate errors by colour alone.
Anatomy
- labelAlways visible, linked with for/id.
- input-field1px border.control; error adds an inset accent ring.
- hintOptional help text between label and field, linked with aria-describedby.
- error-messageIcon and text in accent, announced with an “Error:” prefix.
Examples
Read-only value inside a form
Set by an administrator.
With hint
I reply within two working days.
Error
Error: Enter a complete email address.
Props
| Name | Type | Default | Description |
|---|---|---|---|
| readOnly | boolean | false | Shows a value people can select and copy but not change, on the sunken surface, e.g. a role set by an admin. |
| label (required) | string | – | Visible label. Never replaced by a placeholder. |
| hint | string | – | Help text between label and field. |
| error | string | – | Error message. Sets aria-invalid; overrides the native validation message. |
| optional | boolean | false | Adds “(optional)” to the label. |
| messages | ValidationMessages | – | Texts for native validation (valueMissing, typeMismatch …) inside a Form. |
| disabled | boolean | false | Disables the field. |
| …input | InputHTMLAttributes | – | All native attributes except placeholder. |
Tokens used
| Token | Tier | Value | Utility |
|---|---|---|---|
| input.bg | component | #FAFAF7 | |
| input.border | component | #8A8578 | |
| input.errorRing | component | #C6492E | |
| input.height | component | 48px | |
| input.paddingX | component | 16px | |
| input.radius | component | 8px | |
| focus | semantic | #C6492E | |
| state.disabled | semantic | 0.5 | |
| surface.page | semantic | #FAFAF7 | |
| surface.sunken | semantic | #EFEDE6 | |
| text.primary | semantic | #0A0A0B | |
| type.body.size | semantic | 16px |
Accessibility
| 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) | Tested |
| Screen reader | Manual | Not tested yet |
Keyboard
| Key | Action |
|---|---|
| Tab | Moves focus into the field. |
Semantics and focus
- <label for> connects label and field.
- aria-describedby points at hint and error text.
- Errors show as icon, text and an extra inset ring in accent (the border stays border.control, no layout shift); screen readers hear “Error:” first.
Contrast
| Pairing | Ratio (x:1) | Minimum | Status |
|---|---|---|---|
| text.primary on surface.page | 18.92 | 4.5 | Pass |
| accent.default on surface.page | 4.57 | 4.5 | Pass |
| border.control on surface.page | 3.52 | 3.0 | Pass |
| focus on surface.page | 4.57 | 3.0 | Pass |
| text.primary on surface.sunken | 16.89 | 4.5 | Pass |
| focus on surface.sunken | 4.08 | 3.0 | Pass |
| accent.default on surface.sunken | 4.08 | 3.0 | Pass |