Skip to content
Storybook

Dropdown menu

A menu of actions opened from a button. Section labels, dividers, shortcuts and a destructive item.

Preview

React · live from the Storybook

HTML and CSS

The same component as plain HTML with pixels-ui.css, no framework needed.

Usage

  • Use for actions. For choosing a value, use Select.

Installation

Included in the core files. No extra install.

HTML
<link rel="stylesheet" href="/css/pixels-tokens.css">
<link rel="stylesheet" href="/css/pixels-ui.css">
<script src="/js/pixels-ui.js" defer></script>

Examples

Static menu

The panel on its own (Menu component in Figma).

API reference

Class / attributeTypeDescription
data-px-menu + aria-controlsattributeTrigger that opens the menu.
px-menu · --floating · --smclassPanel.
px-menu__item · --destructiveclassItem (Figma Type).
px-menu__label · __sep · __shortcutclassSection label, divider, shortcut.

Figma properties

Menu2 variants · page “Dropdown”Open

Dropdown / context menu panel: optional section label, items, dividers. Elevation lg on --px-menu-background. Close on Escape and outside click; return focus to the trigger.

PropertyTypeValues
DirectionVariantLTR RTL
Menu item40 variants · page “Dropdown”Open

One row in a Menu, Select or Combobox list. Selected shows a check (single-select). Destructive for delete / sign-out. Keyboard: arrow keys move focus, Enter selects. RTL text: Label property drives L…

PropertyTypeValues
LabelText“Menu item”
Leading iconBoolean—
Leading icon swapInstance swap—
ShortcutBoolean—
Shortcut textText“⌘K”
SizeVariantSmall Medium
TypeVariantDefault Destructive
StateVariantActive Hover Focused Disabled Selected
DirectionVariantLTR RTL

Design tokens

Component tokens from the Figma Component collection. Override them to restyle just this component.

TokenAliasLight value
--px-menu-backgroundcolor-surface-overlay#ffffff
--px-menu-bordercolor-border-neutral-subtle#f2f4f7
--px-menu-item-background-hovercolor-background-neutral-default#f2f4f7
--px-menu-item-background-selectedcolor-background-brand-subtle#eff6ff
--px-menu-item-content-selectedcolor-content-brand-default#2563eb
--px-menu-item-content-destructivecolor-content-danger-default#b42318
--px-menu-item-iconcolor-content-neutral-secondary#475467
--px-menu-sectioncolor-content-neutral-tertiary#667085
--px-menu-radiusradius-1212px
--px-menu-item-radiusradius-88px
--px-menu-paddingspacing-xs4px
--px-menu-item-padding-xspacing-1212px
--px-menu-item-gapspacing-sm8px
--px-menu-item-height-smcontrol-height-sm32px
Show all 16 tokens
TokenAliasLight value
--px-menu-item-height-mdcontrol-height-md40px
--px-menu-width240px240px

Accessibility

  • Arrow keys move; Escape closes and returns focus to the trigger.
  • Close on outside click.