Dropdown Menu
Displays a menu of actions or options triggered by a button. In Figma the menu is one component with an Items slot; the menus below (icons, checkboxes, modes, switches) are samples of what goes in it.
veritheme.js
JS init: automatic
Default
With Icons
Dropdown menu items with leading icons for visual context.
With Checkbox Items
Menu items with checkboxes for toggling settings.
Mode Picker
Pick one mode: each row has a title, a short description and a check at the end on the chosen one. Rows are role="menuitemradio" with aria-checked; veritheme.selectMenuRadio moves the check.
With Switches
On/off settings: a switch at the end of each row shows its state. The row is the control (role="menuitemcheckbox" with aria-checked); the switch is a decorative span (aria-hidden) and veritheme.toggleCheckbox turns it on and off. The menu stays open, so several settings can be changed in a row. A group label (vt-menu-label) names the group.
With Radio Items
Menu items with radio buttons for single selection.
Placement
Below the trigger from its left edge by default. vt-dropdown-menu-up opens the menu above the trigger, for an input at the bottom of the screen; vt-dropdown-menu-end aligns it to the trigger's right edge. They combine, and the script still flips a menu to the other side when it would leave the window. In Figma the open menu is drawn where it opens: the side and the edge follow from where it sits next to its trigger.
Guidelines
Anatomy
div.vt-dropdown-wrap ← Position anchor
├── button[data-vt-dropdown-trigger="id"] ← Toggle trigger
└── div#id.vt-dropdown-menu ← Floating menu panel
├── div.vt-dropdown-label ← Group label (optional)
├── div.vt-command-item ← Row (MenuItem)
│ ├── svg | .vt-checkbox | .vt-radio ← Leading icon or control
│ └── text ← Label
└── div.vt-separator ← Group divider
API Reference
| Class | Type | Description |
|---|---|---|
vt-dropdown-wrap |
Base | Positioning anchor around the trigger and the menu |
vt-dropdown-menu |
Base | Floating panel under the trigger: card surface, border, large shadow; hidden until opened |
vt-open |
State | Shows the menu (the JS bundle toggles it from [data-vt-dropdown-trigger]) |
vt-dropdown-menu-up |
Modifier | Opens above the trigger (an input at the bottom of the screen); flips below when there is no room above |
vt-dropdown-menu-end |
Modifier | Aligns the right edge of the menu with the right edge of the trigger (a trigger near the right side); combines with -up |
vt-dropdown-menu-static |
Modifier | Shows the menu in the flow, for a menu drawn inside a panel or a preview |
vt-command-item |
Part | A menu row — MenuItem; its corners follow the menu (radius-lg − 4px inset) |
vt-command-item-icon |
Part | Leading icon of a row |
vt-command-item-content |
Part | Title over a muted description in a mode-picker row (MenuItem) |
vt-command-item-check-end |
Part | Check at the end of a pick-one row (role="menuitemradio"), shown on the checked row |
vt-command-danger |
Modifier | Destructive row — error text and icon, error surface when highlighted (hover or selected) |
vt-checkbox |
Part | Checkbox inside a checkable row; the row gets role="menuitemcheckbox" and aria-checked |
vt-radio |
Part | Radio inside a single-choice row; the row gets role="menuitemradio" and aria-checked |
vt-dropdown-items |
Part | Optional plain column around the rows — the Items slot in Figma; a menu without it works the same |
vt-switch |
Part | Switch at the end of an on/off row (vt-switch vt-switch-sm, a span with aria-hidden, vt-active when on); the row is role="menuitemcheckbox" with aria-checked and veritheme.toggleCheckbox turns it |
vt-menu-label |
Part | Group label (MenuLabel) — small muted text, aligned with the rows; role="presentation", the group around the rows takes role="group" with aria-labelledby. The same in Command |
vt-dropdown-label |
Part | Older name of the group label: looks the same as vt-menu-label and still works |
vt-separator |
Part | Divider between groups: the Separator component, right against the rows (they have their own padding). The older .vt-menu-separator and .vt-dropdown-separator are deprecated |
Accessibility
| Feature | Details |
|---|---|
| Role | Use role="menu" on dropdown, trigger has aria-haspopup="menu" |
| Items | Menu items use role="menuitem", checkable items use role="menuitemcheckbox" / "menuitemradio" with aria-checked |
| Keyboard | Arrow keys navigate, Enter/Space activate, Escape closes menu |
| Expanded | Trigger has aria-expanded reflecting menu open/closed state |
| Focus | Focus moves to first item on open, returns to trigger on close |