Input
A labeled field for a short typed value.
In Dense data
See it live
npm run storybookWhen to use it
In Dense data: Search and edit fields.
- 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 Dense data uses it
Words
- Lead with the object, then the state: "Alert 2041 contained."
- Use numbers, not words for numbers.
- One verb per button. No "please", no exclamation marks.
- Use: Investigate, Filter, Assign, Escalated, Resolved. Avoid: Oops, Awesome, Please, Simply.
The labels components use, from the voice tokens:
content.action.commit: Savecontent.action.cancel: Cancelcontent.action.destroy: Deletecontent.action.retry: Retrycontent.action.empty-action: Change filters
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.
Dense data 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.
| Part | Its token and the semantic it aliases | Value |
|---|---|---|
| Input | ||
| Fill Changes with theme | component.input.backgroundcolor.surface.defaultvar(--input-background) | Lightslate.light.0:#FFFFFFDarkslate.dark.50:#161B23 |
| Text Changes with theme | component.input.textcolor.text.primaryvar(--input-text) | Lightslate.light.900:#161B23Darkslate.dark.900:#F7F8FA |
| Placeholder Changes with theme | component.input.placeholdercolor.text.mutedvar(--input-placeholder) | Lightslate.light.600:#535D6DDarkslate.dark.400:#969FAD |
| Height | component.input.heightsize.control.defaultvar(--input-height) | size.32:2rem |
| Padding, left and right | component.input.padding-xspace.inset.control-xvar(--input-padding-x) | space.12:0.75rem |
| Corner | component.input.radiusradius.controlvar(--input-radius) | radius.2:0.125rem |
| Text size | component.input.font-sizetype.body.font-sizevar(--input-font-size) | font.size.14:0.875rem |
| Font family | component.input.font-familytype.body.font-familyvar(--input-font-family) | font.family.ibm-plex-sans:"IBM Plex Sans", system-ui, sans-serif |
| Border width | component.input.border-widthborder-width.defaultvar(--input-border-width) | border-width.1:1px |
| Focus on focus | component.input.focusborder-width.focusvar(--input-focus) | border-width.2:2px |
| Canvas Changes with theme on focus | component.input.canvascolor.surface.canvasvar(--input-canvas) | Lightslate.light.50:#F7F8FADarkslate.dark.0:#0D1117 |
| 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) | Lightslate.light.500:#6B7585Darkslate.dark.400:#969FAD |
| Focus Changes with theme on focus | component.input.border.focuscolor.border.focusvar(--input-border-focus) | Lightviolet.light.600:#4B3FD9Darkviolet.dark.600:#A9A3F6 |
| Disabled | ||
| Fill Changes with theme when disabled | component.input.disabled.backgroundcolor.disabled.surfacevar(--input-disabled-background) | Lightslate.light.100:#EEF1F5Darkslate.dark.100:#262D38 |
| Border Changes with theme when disabled | component.input.disabled.bordercolor.disabled.bordervar(--input-disabled-border) | Lightslate.light.200:#DDE2EADarkslate.dark.200:#3D4655 |
| Text Changes with theme when disabled | component.input.disabled.textcolor.disabled.textvar(--input-disabled-text) | Lightslate.light.500:#6B7585Darkslate.dark.500:#C4CBD6 |