Skip to main content

Native select

The browser's own select, styled.

In Accessible first

See it live​

Start Storybook to see it live: npm run storybook

When to use it​

In Accessible first: A browser select that every assistive technology understands.

  • 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​

  • Use common words. Explain any term you must use.
  • One idea per sentence. Put the action first.
  • Never blame the person.
  • Use: Continue, Change, Start, You. Avoid: Invalid, Utilise, Submit, Error code.

The labels components use, from the voice tokens:

  • content.action.commit: Continue
  • content.action.cancel: Go back
  • content.action.destroy: Delete
  • content.action.retry: Try again
  • content.action.empty-action: Start a new application

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.

Changes with theme

Accessible first 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
Native select
Disabled opacitycomponent.native-select.disabled-opacityopacity.disabledvar(--native-select-disabled-opacity)opacity.50:0.5
Cornercomponent.native-select.radiusradius.controlvar(--native-select-radius)radius.6:0.375rem
Border
Changes with theme
component.native-select.bordercolor.border.strongvar(--native-select-border)Lightgray.light.500:#595959Darkgray.dark.500:#949494
Padding, left and rightcomponent.native-select.padding-xspace.inset.control-xvar(--native-select-padding-x)space.24:1.5rem
Padding, top and bottomcomponent.native-select.padding-ycomponent-spacing-map.x2var(--native-select-padding-y)space.8:0.5rem
Padding rightcomponent.native-select.padding-rightcomponent-spacing-map.x8var(--native-select-padding-right)space.56:3.5rem
Text sizecomponent.native-select.font-sizetype.body.font-sizevar(--native-select-font-size)font.size.19:1.1875rem
Shadowcomponent.native-select.shadowelevation.cardvar(--native-select-shadow)shadow.none
Fill
Changes with theme
component.native-select.backgroundcolor.action.primaryvar(--native-select-background)Lightblue.light.600:#0B4FC0Darkblue.dark.600:#8AB4F8
Text
Changes with theme
component.native-select.labelcolor.text.on-actionvar(--native-select-label)Lightgray.light.0:#FFFFFFDarkgray.light.900:#141414
Label placeholder
Changes with theme
component.native-select.label-placeholdercolor.text.mutedvar(--native-select-label-placeholder)Lightgray.light.500:#595959Darkgray.dark.500:#949494
Heightcomponent.native-select.heightsize.control.defaultvar(--native-select-height)size.52:3.25rem
Padding y 2component.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)Lightblue.light.600:#0B4FC0Darkblue.dark.600:#8AB4F8
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)Lightblue.light.600:#0B4FC0Darkblue.dark.600:#8AB4F8
Focus ring offset focus
Changes with theme
on focus
component.native-select.focus-ring-offset-focuscolor.surface.canvasvar(--native-select-focus-ring-offset-focus)Lightgray.light.50:#F7F7F7Darkgray.dark.0:#0A0A0A
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 sizecomponent.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)Lightgray.light.500:#595959Darkgray.dark.500:#949494
From the system
Edge
Changes with theme
color.border.default
straight from the system, through --border
Lightgray.light.200 · #D6D6D6Darkgray.dark.100 · #222222