Select
One choice from a list, in a menu.
In Content first
See it live
npm run storybookWhen to use it
In Content first: A closed list whose options need more than plain text. Not for a short list readers should see at once.
- Use it when: Four or more options, a known closed list, or a setting with a default.
- Not when: Two to five options people should see (radio group), or many flags (checkboxes).
Instead:
- Radio group: A short list shown at once.
- Combobox: Type to find in a long list.
- Native select: The system picker.
Words
- Write to one person: "you", not "users".
- Short sentences with room to breathe.
- Explain why before asking for anything.
- Use: Read, Save for later, You, Next issue. Avoid: Click here, Submit, Users, Content.
The labels components use, from the voice tokens:
content.action.commit: Savecontent.action.cancel: Not nowcontent.action.destroy: Removecontent.action.retry: Try againcontent.action.empty-action: Browse guides
See Voice and tone for the whole voice.
Accessibility and keyboard
| Keyboard | What happens | Not |
|---|---|---|
| undefined | Arrows move; Enter picks; Escape closes. | undefined |
Test before you ship:
- It has a visible label; the chosen value is announced. undefined
Use it in code
npx open-ds add select
The component reads only component keys and semantic tokens, so it follows the brand and mode on <html>.
Tokens it reads
Select reads 30 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 Select's tokens to change Select alone.
Content 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.
| Part | Its token and the semantic it aliases | Value |
|---|---|---|
| Shared | ||
| Input background Changes with theme | component.input.backgroundcolor.surface.defaultvar(--input-background) | Lightstone.light.0:#FFFFFFDarkstone.dark.50:#1F1B16 |
| Input border @ Changes with theme | component.input.bordercolor.border.strongvar(--input-border) | Lightstone.light.500:#7A7062Darkstone.dark.400:#A39A8B |
| Input border focus Changes with theme on focus | component.input.border.focuscolor.border.focusvar(--input-border-focus) | Lightnavy.light.600:#1E3A5FDarknavy.dark.600:#8FA6C4 |
| Input text Changes with theme | component.input.textcolor.text.primaryvar(--input-text) | Lightstone.light.900:#1F1B16Darkstone.dark.900:#FFFDF8 |
| Input placeholder Changes with theme | component.input.placeholdercolor.text.mutedvar(--input-placeholder) | Lightstone.light.600:#61594DDarkstone.dark.400:#A39A8B |
| Input height | component.input.heightsize.control.defaultvar(--input-height) | size.48:3rem |
| Input padding x | component.input.padding-xspace.inset.control-xvar(--input-padding-x) | space.20:1.25rem |
| Input radius | component.input.radiusradius.controlvar(--input-radius) | radius.8:0.5rem |
| Input font size | component.input.font-sizetype.body.font-sizevar(--input-font-size) | font.size.18:1.125rem |
| Overlay background Changes with theme | component.overlay.backgroundcolor.surface.raisedvar(--overlay-background) | Lightstone.light.0:#FFFFFFDarkstone.dark.100:#2E2A24 |
| Overlay radius | component.overlay.radiusradius.containervar(--overlay-radius) | radius.12:0.75rem |
| Overlay shadow Changes with theme | component.overlay.shadowelevation.overlayvar(--overlay-shadow) | Lightshadow.overlay:0px 12px 32px 0px #1F1B1629Darkshadow.overlay-dark:0px 12px 32px 0px #00000080 |
| Overlay item height | component.overlay.item-heightsize.control.defaultvar(--overlay-item-height) | size.48:3rem |
| Trigger | ||
| Gap | component.select.trigger.gapspace.gap.defaultvar(--select-trigger-gap) | space.16:1rem |
| Font family | component.select.trigger.font-familytype.body.font-familyvar(--select-trigger-font-family) | font.family.source-serif-4:"Source Serif 4", Georgia, serif |
| Border width | component.select.trigger.border-widthborder-width.defaultvar(--select-trigger-border-width) | border-width.1:1px |
| Select | ||
| Focus on focus | component.select.focusborder-width.focusvar(--select-focus) | border-width.2:2px |
| Canvas Changes with theme on focus | component.select.canvascolor.surface.canvasvar(--select-canvas) | Lightstone.light.50:#FFFDF8Darkstone.dark.0:#14110D |
| Size | component.select.sizesize.iconvar(--select-size) | size.16:1rem |
| Content | ||
| Padding | component.select.content.paddingcomponent-spacing-map.x1var(--select-content-padding) | space.4:0.25rem |
| Text Changes with theme | component.select.content.labelcolor.text.primaryvar(--select-content-label) | Lightstone.light.900:#1F1B16Darkstone.dark.900:#FFFDF8 |
| Border width | component.select.content.border-widthborder-width.defaultvar(--select-content-border-width) | border-width.1:1px |
| Border Changes with theme | component.select.content.bordercolor.border.defaultvar(--select-content-border) | Lightstone.light.200:#E4DDD0Darkstone.dark.100:#2E2A24 |
| Item | ||
| Gap | component.select.item.gapspace.gap.defaultvar(--select-item-gap) | space.16:1rem |
| Padding left | component.select.item.padding-leftspace.inset.cell-xvar(--select-item-padding-left) | space.16:1rem |
| Padding right | component.select.item.padding-rightcomponent-spacing-map.x8var(--select-item-padding-right) | space.48:3rem |
| Corner | component.select.item.radiusradius.badgevar(--select-item-radius) | radius.999:9999px |
| Text size | component.select.item.font-sizetype.body.font-sizevar(--select-item-font-size) | font.size.18:1.125rem |
| Sunken Changes with theme on focus | component.select.item.sunkencolor.surface.sunkenvar(--select-item-sunken) | Lightstone.light.100:#F6F2EADarkstone.dark.100:#2E2A24 |
| Disabled when disabled | component.select.item.disabledopacity.disabledvar(--select-item-disabled) | opacity.40:0.4 |