Skip to content

Input ​

A single line of text: a name, an email address, a search.

Open in Storybook to try every prop.

When to use ​

  • Short free text on one line: names, email addresses, IDs, search terms.

When not to use ​

  • Several lines of notes: use InputRichText.
  • A number someone steps through (a year group, a quantity): use InputNumber.
  • A date: use InputDate.
  • A password: use InputPassword. A one-time code: use InputCode.
  • Choosing from a list: use Select or RadioGroup.

Anatomy ​

PartRequiredNotes
labelYes14px, above the box. Also the input's accessible name.
helperNo12px under the label, or behind a ? (InfoTip) beside it.
boxYesFormField's box: like a medium basic Button, 38px tall, 4px corners, 12px / 8px padding.
leading / trailingNoSlots either side of the text, e.g. a search or mail icon. Icons are 16px, 70% opacity.
inputYes14px text (16px on touch screens). Placeholder black 55%.
messageNoError, success or loading text that slides open under the box.

Properties ​

PropertyTypeDefaultDescription
modelValuestring''The text. Use v-model.
labelstring—Required.
helper / helperPlacementstring / below | icon— / belowExtra guidance, under the label or behind a ?.
errorTextstring—Error message, e.g. from a Zod schema. Overrides everything below.
status / statusTexterror | success | loading / string—Colours the box and the message; loading shows a spinner, e.g. "Checking availability…".
minLengthnumber—Shows "Must be at least N characters" once the field has been left.
maxLengthnumber—Shows "Must be N characters or fewer" straight away. Typing isn't blocked.
disabledbooleanfalse40% opacity, not editable.

Attributes such as type, name, placeholder and autocomplete go to the <input>.

States ​

StateAppearanceNotes
EnabledWhite box, black 15% border.
FocusedFocus ring around the box.
ErrorRed border and message.
SuccessGreen border and message.
LoadingSpinner and message; border unchanged.
Disabled40% opacity.

Behaviour ​

  • Pressing anywhere in the box, including its padding and icons, focuses the input.
  • "Too short" waits until the field has been left once, so it doesn't complain while someone is still typing. "Too long" shows straight away.
  • An error clears as soon as the value becomes valid.

Content guidelines ​

  • Label: a short noun phrase, e.g. "Email address", not a question.
  • Put examples and rules in the helper, not the placeholder: placeholders vanish while typing.

Accessibility ​

  • The label is a real <label> for the input. Helper and message are its description (aria-describedby); the message is announced politely.
  • Errors set aria-invalid.

Platform adaptation ​

PlatformImplementationDifferences
Web / desktop (Vue)Input.vueBuilt on FormField.
iOS (SwiftUI)—TextField with the label above; the right textContentType and keyboard.
Android (Compose)—OutlinedTextField-like field with the label above, not floating.

Tokens used ​

TokenUsed for
color-focusFocus ring
color-red / color-greenError / success

Released under the PolyForm Noncommercial License 1.0.0.