Skip to content

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

Updated 2026-11-12

Playground

Change the props. The controls come from the documented props.

As it appears on invoices.

tsx
<Input
  label="Company"
  name="playground-company"
  hint="As it appears on invoices."
/>

States

Every variant in every state, side by side. Hover, pressed and focus are shown statically; the default state is interactive.
  • default
  • focus-visible
  • disabled
  • Error: Enter first and last name.

    invalid

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.
Do
  • Keep the label short and unambiguous.
  • The error message says how to fix it.
Don’t
  • Don't use a placeholder as the label.
  • Don't communicate errors by colour alone.

Anatomy

The parts of the component and what each one does, as in the playground above.
  1. labelAlways visible, linked with for/id.
  2. input-field1px border.control; error adds an inset accent ring.
  3. hintOptional help text between label and field, linked with aria-describedby.
  4. error-messageIcon and text in accent, announced with an “Error:” prefix.

Examples

Type-checked, and the same code goes into the AI manifest. Import: import { Input } from "@/ds";

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

Checked against the component's TypeScript type on every build.
Input props
NameTypeDefaultDescription
readOnlybooleanfalseShows 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.
hintstring–Help text between label and field.
errorstring–Error message. Sets aria-invalid; overrides the native validation message.
optionalbooleanfalseAdds “(optional)” to the label.
messagesValidationMessages–Texts for native validation (valueMissing, typeMismatch …) inside a Form.
disabledbooleanfalseDisables the field.
…inputInputHTMLAttributes–All native attributes except placeholder.

Tokens used

Derived from the utility classes in the component's source. Copy a class with one click.
Tokens used by Input
TokenTierValueUtility
input.bgcomponent#FAFAF7
input.bordercomponent#8A8578
input.errorRingcomponent#C6492E
input.heightcomponent48px
input.paddingXcomponent16px
input.radiuscomponent8px
focussemantic#C6492E
state.disabledsemantic0.5
surface.pagesemantic#FAFAF7
surface.sunkensemantic#EFEDE6
text.primarysemantic#0A0A0B
type.body.sizesemantic16px

Accessibility

What is checked automatically on every build, and what a person has tested. Nothing is marked as tested unless it was.
Testing status by check
CheckHowStatus
axe-core rulesAutomated on every npm run check, at desktop and mobile widthRuns on every build
KeyboardAutomated Playwright test (scripts/keyboard.mjs)Tested
Screen readerManualNot tested yet

Keyboard

Input keyboard interactions
KeyAction
TabMoves 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

Input contrast pairings
PairingRatio (x:1)MinimumStatus
text.primary on surface.page18.924.5Pass
accent.default on surface.page4.574.5Pass
border.control on surface.page3.523.0Pass
focus on surface.page4.573.0Pass
text.primary on surface.sunken16.894.5Pass
focus on surface.sunken4.083.0Pass
accent.default on surface.sunken4.083.0Pass