Dropdown menu
A menu of actions opened from a button.
In Brand expressive
See it live
npm run storybookWhen to use it
In Brand expressive: A few now-and-then actions on a piece, such as sharing the drop. Not for the one main action.
- Use it when: More actions than fit, or actions people use now and then.
- Not when: Choosing a value for a field (select), or the one main action (a button).
Instead:
- Select: Choosing a value.
- Context menu: The same menu on right-click.
How Brand expressive uses it
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.
Accessibility and keyboard
| Keyboard | What happens | Not |
|---|---|---|
| undefined | Arrows move; Enter runs; Escape closes and returns focus. | undefined |
Test before you ship:
- The trigger says it opens a menu and whether it is open. undefined
Use it in code
npx open-ds add dropdown-menu
The component reads only component keys and semantic tokens, so it follows the brand and mode on <html>.
Tokens it reads
Dropdown menu reads 17 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 Dropdown menu's tokens to change Dropdown menu 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 |
|---|---|---|
| Shared | ||
| Overlay background Changes with theme | component.overlay.backgroundcolor.surface.raisedvar(--overlay-background) | Lighttaupe.light.0:#FFFFFFDarktaupe.dark.100:#33241F |
| Overlay radius | component.overlay.radiusradius.containervar(--overlay-radius) | radius.24:1.5rem |
| Overlay shadow Changes with theme | component.overlay.shadowelevation.overlayvar(--overlay-shadow) | Lightshadow.overlay:0px 24px 48px 0px #1F141133Darkshadow.overlay-dark:0px 24px 48px 0px #00000099 |
| Overlay item height | component.overlay.item-heightsize.control.defaultvar(--overlay-item-height) | size.52:3.25rem |
| Content | ||
| Padding | component.dropdown-menu.content.paddingcomponent-spacing-map.x1var(--dropdown-menu-content-padding) | space.4:0.25rem |
| Text Changes with theme | component.dropdown-menu.content.labelcolor.text.primaryvar(--dropdown-menu-content-label) | Lighttaupe.light.900:#1F1411Darktaupe.dark.900:#FFF8F3 |
| Border width | component.dropdown-menu.content.border-widthborder-width.defaultvar(--dropdown-menu-content-border-width) | border-width.2:2px |
| Border Changes with theme | component.dropdown-menu.content.bordercolor.border.defaultvar(--dropdown-menu-content-border) | Lighttaupe.light.200:#F2DCCFDarktaupe.dark.100:#33241F |
| Item | ||
| Gap | component.dropdown-menu.item.gapspace.gap.defaultvar(--dropdown-menu-item-gap) | space.16:1rem |
| Padding, left and right | component.dropdown-menu.item.padding-xspace.inset.cell-xvar(--dropdown-menu-item-padding-x) | space.16:1rem |
| Corner | component.dropdown-menu.item.radiusradius.badgevar(--dropdown-menu-item-radius) | radius.999:9999px |
| Text size | component.dropdown-menu.item.font-sizetype.body.font-sizevar(--dropdown-menu-item-font-size) | font.size.17:1.0625rem |
| Sunken Changes with theme on focus | component.dropdown-menu.item.sunkencolor.surface.sunkenvar(--dropdown-menu-item-sunken) | Lighttaupe.light.100:#FCEFE6Darktaupe.dark.100:#33241F |
| Disabled when disabled | component.dropdown-menu.item.disabledopacity.disabledvar(--dropdown-menu-item-disabled) | opacity.40:0.4 |
| Icon | component.dropdown-menu.item.iconsize.iconvar(--dropdown-menu-item-icon) | size.20:1.25rem |
| Dropdown menu | ||
| Text Changes with theme | component.dropdown-menu.labelcolor.status.dangervar(--dropdown-menu-label) | Lightred.light.600:#C42B2BDarkred.dark.600:#F28B8B |
| Fill Changes with theme | component.dropdown-menu.backgroundcolor.border.defaultvar(--dropdown-menu-background) | Lighttaupe.light.200:#F2DCCFDarktaupe.dark.100:#33241F |