Native select
The browser's own select, styled.
Left out of Dense data Native select is best on phones, and Dense data runs at a desk. Its select already picks one value. A small team keeps fewer parts right. Use instead: Select, Radio group
See it live
npm run storybookWhen to use it
- Use it when: A plain closed list, especially on phones, where the system picker is best.
- Not when: Options that need icons or rich content (select), or a short list better shown at once (radio group).
Instead:
- Select: A custom menu with richer options.
- Radio group: A short list shown at once.
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.
Use it in code
npx open-ds add native-select
The component reads only component keys and semantic tokens, so it follows the brand and mode on <html>.
Tokens it reads
Native select reads 21 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 Native select's tokens to change Native select 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 |
|---|---|---|
| Native select | ||
| Disabled opacity | component.native-select.disabled-opacityopacity.disabledvar(--native-select-disabled-opacity) | opacity.40:0.4 |
| Corner | component.native-select.radiusradius.controlvar(--native-select-radius) | radius.2:0.125rem |
| Border Changes with theme | component.native-select.bordercolor.border.strongvar(--native-select-border) | Lightslate.light.500:#6B7585Darkslate.dark.400:#969FAD |
| Padding, left and right | component.native-select.padding-xspace.inset.control-xvar(--native-select-padding-x) | space.12:0.75rem |
| Padding, top and bottom | component.native-select.padding-ycomponent-spacing-map.x2var(--native-select-padding-y) | space.8:0.5rem |
| Padding right | component.native-select.padding-rightcomponent-spacing-map.x8var(--native-select-padding-right) | space.32:2rem |
| Text size | component.native-select.font-sizetype.body.font-sizevar(--native-select-font-size) | font.size.14:0.875rem |
| Shadow | component.native-select.shadowelevation.cardvar(--native-select-shadow) | shadow.none |
| Fill Changes with theme | component.native-select.backgroundcolor.action.primaryvar(--native-select-background) | Lightviolet.light.600:#4B3FD9Darkviolet.dark.600:#A9A3F6 |
| Text Changes with theme | component.native-select.labelcolor.text.on-actionvar(--native-select-label) | Lightslate.light.0:#FFFFFFDarkslate.light.900:#161B23 |
| Label placeholder Changes with theme | component.native-select.label-placeholdercolor.text.mutedvar(--native-select-label-placeholder) | Lightslate.light.600:#535D6DDarkslate.dark.400:#969FAD |
| Height | component.native-select.heightsize.control.defaultvar(--native-select-height) | size.32:2rem |
| Padding y 2 | component.native-select.padding-y-2component-spacing-map.x1var(--native-select-padding-y-2) | space.4:0.25rem |
| Border focus Changes with theme | component.native-select.border-focuscolor.border.focusvar(--native-select-border-focus) | Lightviolet.light.600:#4B3FD9Darkviolet.dark.600:#A9A3F6 |
| Focus on focus | component.native-select.focusborder-width.focusvar(--native-select-focus) | border-width.2:2px |
| Focus ring focus Changes with theme on focus | component.native-select.focus-ring-focuscolor.border.focusvar(--native-select-focus-ring-focus) | Lightviolet.light.600:#4B3FD9Darkviolet.dark.600:#A9A3F6 |
| Focus ring offset focus Changes with theme on focus | component.native-select.focus-ring-offset-focuscolor.surface.canvasvar(--native-select-focus-ring-offset-focus) | Lightslate.light.50:#F7F8FADarkslate.dark.0:#0D1117 |
| Border invalid Changes with theme when invalid | component.native-select.border-invalidcolor.status.dangervar(--native-select-border-invalid) | Lightred.light.600:#C42B2BDarkred.dark.600:#F28B8B |
| Focus ring invalid Changes with theme when invalid | component.native-select.focus-ring-invalidcolor.status.dangervar(--native-select-focus-ring-invalid) | Lightred.light.600:#C42B2BDarkred.dark.600:#F28B8B |
| Icon size | component.native-select.icon-sizesize.iconvar(--native-select-icon-size) | size.16:1rem |
| Label 2 Changes with theme | component.native-select.label-2color.text.mutedvar(--native-select-label-2) | Lightslate.light.600:#535D6DDarkslate.dark.400:#969FAD |
| From the system | ||
| Edge Changes with theme | color.border.default straight from the system, through --border | Lightslate.light.200 · #DDE2EADarkslate.dark.100 · #262D38 |