Native select
The browser's own select, styled.
In Brand expressive
See it live
npm run storybookWhen to use it
In Brand expressive: A plain closed list on a phone, such as a size. Not for a short list better shown at once.
- 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
- 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: Gocontent.action.cancel: Not nowcontent.action.destroy: Removecontent.action.retry: Try againcontent.action.empty-action: Explore the drop
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.
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.
| 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.999:9999px |
| Border Changes with theme | component.native-select.bordercolor.border.strongvar(--native-select-border) | Lighttaupe.light.500:#8A6F63Darktaupe.dark.400:#B5988A |
| Padding, left and right | component.native-select.padding-xspace.inset.control-xvar(--native-select-padding-x) | space.28:1.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.64:4rem |
| Text size | component.native-select.font-sizetype.body.font-sizevar(--native-select-font-size) | font.size.17:1.0625rem |
| Shadow Changes with theme | component.native-select.shadowelevation.cardvar(--native-select-shadow) | Lightshadow.cardDarkshadow.card-dark |
| Fill Changes with theme | component.native-select.backgroundcolor.action.primaryvar(--native-select-background) | Lightpink.light.600:#D61F7ADarkpink.dark.600:#F59ACA |
| Text Changes with theme | component.native-select.labelcolor.text.on-actionvar(--native-select-label) | Lighttaupe.light.0:#FFFFFFDarktaupe.light.900:#1F1411 |
| Label placeholder Changes with theme | component.native-select.label-placeholdercolor.text.mutedvar(--native-select-label-placeholder) | Lighttaupe.light.600:#6B544ADarktaupe.dark.400:#B5988A |
| Height | component.native-select.heightsize.control.defaultvar(--native-select-height) | size.52:3.25rem |
| 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) | Lightpink.light.600:#D61F7ADarkpink.dark.600:#F59ACA |
| Focus on focus | component.native-select.focusborder-width.focusvar(--native-select-focus) | border-width.3:3px |
| Focus ring focus Changes with theme on focus | component.native-select.focus-ring-focuscolor.border.focusvar(--native-select-focus-ring-focus) | Lightpink.light.600:#D61F7ADarkpink.dark.600:#F59ACA |
| Focus ring offset focus Changes with theme on focus | component.native-select.focus-ring-offset-focuscolor.surface.canvasvar(--native-select-focus-ring-offset-focus) | Lighttaupe.light.50:#FFF8F3Darktaupe.dark.0:#120B09 |
| 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.20:1.25rem |
| Label 2 Changes with theme | component.native-select.label-2color.text.mutedvar(--native-select-label-2) | Lighttaupe.light.600:#6B544ADarktaupe.dark.400:#B5988A |
| From the system | ||
| Edge Changes with theme | color.border.default straight from the system, through --border | Lighttaupe.light.200 · #F2DCCFDarktaupe.dark.100 · #33241F |