Skip to main content

Input

A labeled field for a short typed value.

In Brand expressive

See it live​

Start Storybook to see it live: npm run storybook

When to use it​

In Brand expressive: The sign-up email.

  • Use it when: A name, email, phone number or other one-line answer.
  • Not when: Long text (textarea), or a closed choice (radio group, select or checkbox).

Instead:

How Brand expressive uses it​

Field label or column header
Use type.label
Not type.caption
Labels stay readable on vivid color.

Words​

  • Headlines are short and bold. Three to six words.
  • Verbs that move: Join, Try, Go.
  • Playful in headlines, plain in errors.
  • Use: Join, Drop, Go, Love. Avoid: Synergy, Leverage, Kindly.

The labels components use, from the voice tokens:

  • content.action.commit: Go
  • content.action.cancel: Not now
  • content.action.destroy: Remove
  • content.action.retry: Try again
  • content.action.empty-action: Explore the drop

See Voice and tone for the whole voice.

Accessibility and keyboard​

Test before you ship:

  • A visible label, never a placeholder as the only label. undefined

Use it in code​

npx open-ds add input

The component reads only component keys and semantic tokens, so it follows the brand and mode on <html>.

Tokens it reads​

Input reads 17 tokens of its own, each an alias of a semantic token. Each row is one part: its own token, the semantic it aliases, and the value it ends at. Change a semantic and every component that reads it follows; override one of Input's tokens to change Input alone.

Changes with theme

Brand expressive decides what changes when you switch theme. Here a switch changes colors only, so the marked rows differ between light and dark; everything else holds steady.

PartIts token and the semantic it aliasesValue
Input
Fill
Changes with theme
component.input.backgroundcolor.surface.defaultvar(--input-background)Lighttaupe.light.0:#FFFFFFDarktaupe.dark.50:#1F1411
Text
Changes with theme
component.input.textcolor.text.primaryvar(--input-text)Lighttaupe.light.900:#1F1411Darktaupe.dark.900:#FFF8F3
Placeholder
Changes with theme
component.input.placeholdercolor.text.mutedvar(--input-placeholder)Lighttaupe.light.600:#6B544ADarktaupe.dark.400:#B5988A
Heightcomponent.input.heightsize.control.defaultvar(--input-height)size.52:3.25rem
Padding, left and rightcomponent.input.padding-xspace.inset.control-xvar(--input-padding-x)space.28:1.75rem
Cornercomponent.input.radiusradius.controlvar(--input-radius)radius.999:9999px
Text sizecomponent.input.font-sizetype.body.font-sizevar(--input-font-size)font.size.17:1.0625rem
Font familycomponent.input.font-familytype.body.font-familyvar(--input-font-family)font.family.dm-sans:"DM Sans", system-ui, sans-serif
Border widthcomponent.input.border-widthborder-width.defaultvar(--input-border-width)border-width.2:2px
Focus
on focus
component.input.focusborder-width.focusvar(--input-focus)border-width.3:3px
Canvas
Changes with theme
on focus
component.input.canvascolor.surface.canvasvar(--input-canvas)Lighttaupe.light.50:#FFF8F3Darktaupe.dark.0:#120B09
Danger
Changes with theme
when invalid
component.input.dangercolor.status.dangervar(--input-danger)Lightred.light.600:#C42B2BDarkred.dark.600:#F28B8B
Border
Color
Changes with theme
component.input.bordercolor.border.strongvar(--input-border)Lighttaupe.light.500:#8A6F63Darktaupe.dark.400:#B5988A
Focus
Changes with theme
on focus
component.input.border.focuscolor.border.focusvar(--input-border-focus)Lightpink.light.600:#D61F7ADarkpink.dark.600:#F59ACA
Disabled
Fill
Changes with theme
when disabled
component.input.disabled.backgroundcolor.disabled.surfacevar(--input-disabled-background)Lighttaupe.light.100:#FCEFE6Darktaupe.dark.100:#33241F
Border
Changes with theme
when disabled
component.input.disabled.bordercolor.disabled.bordervar(--input-disabled-border)Lighttaupe.light.200:#F2DCCFDarktaupe.dark.200:#4D3A33
Text
Changes with theme
when disabled
component.input.disabled.textcolor.disabled.textvar(--input-disabled-text)Lighttaupe.light.500:#8A6F63Darktaupe.dark.500:#E2C4B3