Inputs
Text field
A text field takes a short typed value, such as a description or an amount, under a label that stays visible above it; use it when the answer can't be picked from a list.
In kanso-ui as TextField
Anatomy
- Label: above the field, in
ink-muted, always visible. - Container: a
radius-mdbox onsurfacewith a 1pxoutlineborder. - Value: the typed text in
ink; while the field is empty, the placeholder shows an example inink-muted. - Helper text (optional): a hint or a format rule.
- Error message: takes the helper's place, after the
erroricon.
The label sits above, as in Adobe Spectrum, whose default top label copes best with long copy, translation and narrow screens: it is read first, and a long label wraps instead of being cut off. The placeholder never stands in for it: it vanishes at the first keystroke, and translation tools often skip it.
Measurements
From the design’s stylesheet, each design token with the value kanso-ui gives it in light.
| Class | Property | Value |
|---|---|---|
k-field | gap | 6px |
min-width | 0 |
Tokens used
| Design token | In kanso-ui | Light | Dark |
|---|---|---|---|
paper | --kui-color-paper | #fafafa | #121212 |
surface | --kui-color-kanso-surface | #ffffff | #1c1c1c |
ink | --kui-color-ink | #1a1a1a | #ececec |
ink-muted | --kui-color-ink-muted | #5c5c5c | #b3b3b3 |
outline | --kui-color-outline | #8a8a8a | #8c8c8c |
critical | --kui-color-critical | #b3261e | #f2b8b5 |
focus-ring | --kui-color-focus-ring | #1a1a1a | #ececec |
radius-md | --kui-radius-kanso-md | 12px | 12px |
size-control-lg | --kui-sizing-kanso-control-lg | 48px | 48px |
size-control-md | --kui-sizing-kanso-control-md | 40px | 40px |
size-icon-sm | --kui-sizing-kanso-icon-sm | 16px | 16px |
font-plain | --kui-typography-font-family-plain | 'Roboto Flex', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif | 'Roboto Flex', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif |
font-mono | --kui-typography-font-family-mono | 'Roboto Mono', ui-monospace, 'SF Mono', Menlo, monospace | 'Roboto Mono', ui-monospace, 'SF Mono', Menlo, monospace |