v1.3.0 28

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.

Interactive Requires: veritheme.js JS init: automatic

Default

html
Profile
Settings
Billing
Log out
<div class="vt-dropdown-wrap">
  <button class="vt-btn vt-btn-bordered" data-vt-dropdown-trigger="dd-default">

    Open menu
    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" fill="none" class="vt-w-4 vt-h-4" aria-hidden="true">
      <path d="M18 9.00005C18 9.00005 13.5811 15 12 15C10.4188 15 6 9 6 9" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></path>
    </svg>
  </button>
  <div id="dd-default" class="vt-dropdown-menu" data-dropdown-content="">
    <div class="vt-command-item">
      Profile
    </div>
    <div class="vt-command-item">
      Settings
    </div>
    <div class="vt-command-item">
      Billing
    </div>
    <div class="vt-separator vt-separator-h" role="separator"></div>
    <div class="vt-command-item vt-command-danger">
      Log out
    </div>
  </div>
</div>

With Icons

Dropdown menu items with leading icons for visual context.

html
Profile
Settings
New team
Log out
<div class="vt-dropdown-wrap">
  <button class="vt-btn vt-btn-bordered" data-vt-dropdown-trigger="dd-icons">

    Options
    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" fill="none" class="vt-w-4 vt-h-4" aria-hidden="true">
      <path d="M18 9.00005C18 9.00005 13.5811 15 12 15C10.4188 15 6 9 6 9" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></path>
    </svg>
  </button>
  <div id="dd-icons" class="vt-dropdown-menu" data-dropdown-content="">
    <div class="vt-command-item">

      <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" fill="none" class="vt-command-item-icon" aria-hidden="true">
        <path d="M20 21.0001C19.713 17.269 16.7289 14.3151 12.995 14.0662L12 13.9999C11.6446 14.0096 11.3134 14.0225 11.0008 14.0378C7.3 14.2192 4.28417 17.3057 4 21.0001" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></path><circle cx="12" cy="6.99988" r="4" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></circle>
      </svg>
      Profile
    </div>
    <div class="vt-command-item">

      <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" fill="none" class="vt-command-item-icon" aria-hidden="true">
        <path d="M3.95631 10.5829L3.03254 9.07084C2.74505 8.60024 2.7389 8.00978 3.01652 7.5333L3.63533 6.47124C3.90953 6.00064 4.41721 5.71571 4.96162 5.7269L6.69131 5.76245C6.92616 5.76728 7.15379 5.68727 7.34333 5.54846C7.79531 5.21745 8.28334 4.93276 8.80042 4.70139C9.01191 4.60675 9.19222 4.45165 9.30469 4.24903L10.1203 2.77965C10.3847 2.30328 10.8865 2.00781 11.4312 2.00781H12.6937C13.2384 2.00781 13.7403 2.30329 14.0047 2.77966L14.8202 4.24902C14.9327 4.45165 15.113 4.60675 15.3245 4.70139C15.8416 4.93274 16.3296 5.2174 16.7815 5.54838C16.9711 5.68718 17.1987 5.76718 17.4336 5.76235L19.1634 5.72676C19.7078 5.71557 20.2155 6.00049 20.4897 6.47111L21.1085 7.53314C21.3862 8.00963 21.38 8.60009 21.0925 9.07068L20.1687 10.5828C20.0481 10.7803 20.002 11.0134 20.0235 11.2439C20.0707 11.7486 20.0707 12.267 20.0235 12.7717C20.002 13.0022 20.0481 13.2353 20.1687 13.4329L21.0924 14.9448C21.3799 15.4154 21.3861 16.0058 21.1084 16.4823L20.4896 17.5444C20.2154 18.015 19.7077 18.2999 19.1633 18.2887L17.4338 18.2531C17.1989 18.2483 16.9713 18.3283 16.7817 18.4671C16.3297 18.7982 15.8416 19.0829 15.3245 19.3142C15.113 19.4089 14.9327 19.564 14.8202 19.7666L14.0047 21.236C13.7403 21.7123 13.2384 22.0078 12.6937 22.0078H11.4312C10.8866 22.0078 10.3847 21.7123 10.1203 21.236L9.30468 19.7665C9.19222 19.5639 9.01191 19.4088 8.80042 19.3142C8.28329 19.0828 7.79519 18.798 7.34316 18.467C7.15362 18.3282 6.92597 18.2482 6.69111 18.253L4.96175 18.2886C4.41733 18.2998 3.90963 18.0148 3.63543 17.5442L3.01663 16.4822C2.739 16.0057 2.74515 15.4152 3.03264 14.9446L3.95631 13.4327C4.07699 13.2351 4.12309 13.002 4.10154 12.7715C4.05437 12.267 4.05438 11.7486 4.10154 11.244C4.12308 11.0135 4.07699 10.7805 3.95631 10.5829Z" stroke="currentColor" stroke-width="1.5"></path><circle cx="12.0625" cy="12.0078" r="3.5" stroke="currentColor" stroke-width="1.5"></circle>
      </svg>
      Settings
    </div>
    <div class="vt-separator vt-separator-h" role="separator"></div>
    <div class="vt-command-item">

      <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" fill="none" class="vt-command-item-icon" aria-hidden="true">
        <path d="M11.9922 4.00012V20.0001M19.9922 12.0001H3.99222" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></path>
      </svg>
      New team
    </div>
    <div class="vt-separator vt-separator-h" role="separator"></div>
    <div class="vt-command-item vt-command-danger">

      <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" fill="none" class="vt-command-item-icon" aria-hidden="true">
        <path d="M19.996 12H9.99603" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></path><path d="M13.9724 6C13.9259 4.90656 13.7875 4.20981 13.3761 3.67372C13.2165 3.46572 13.0303 3.27954 12.8223 3.11994C12.0144 2.5 10.8416 2.5 8.49603 2.5C6.15046 2.5 4.97767 2.5 4.16975 3.11994C3.96175 3.27954 3.77557 3.46572 3.61597 3.67372C2.99603 4.48164 2.99603 5.65442 2.99603 8L2.99603 16C2.99603 18.3456 2.99603 19.5184 3.61597 20.3263C3.77557 20.5343 3.96175 20.7205 4.16975 20.8801C4.97767 21.5 6.15046 21.5 8.49603 21.5C10.8416 21.5 12.0144 21.5 12.8223 20.8801C13.0303 20.7205 13.2165 20.5343 13.3761 20.3263C13.7875 19.7902 13.9259 19.0934 13.9724 18" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></path><path d="M17.4961 15.5C17.4961 15.5 20.996 12.9223 20.996 12C20.996 11.0777 17.496 8.5 17.496 8.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></path>
      </svg>
      Log out
    </div>
  </div>
</div>

With Checkbox Items

Menu items with checkboxes for toggling settings.

html
Status bar
Activity bar
Panel
<div class="vt-dropdown-wrap">
  <button class="vt-btn vt-btn-bordered" data-vt-dropdown-trigger="dd-check">

    View
    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" fill="none" class="vt-w-4 vt-h-4" aria-hidden="true">
      <path d="M18 9.00005C18 9.00005 13.5811 15 12 15C10.4188 15 6 9 6 9" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></path>
    </svg>
  </button>
  <div id="dd-check" class="vt-dropdown-menu" data-dropdown-content="">
    <div class="vt-command-item" onclick="veritheme.toggleCheckbox(this)">

      <div class="vt-checkbox checked" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" fill="none" class="check-icon" aria-hidden="true">
          <path d="M5 13.2592L7.58583 15.9568C8.2525 16.6523 8.58583 17 9.00004 17C9.41425 17 9.74759 16.6523 10.4143 15.9568L19 7" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="3"></path>
        </svg></div>
      Status bar
    </div>
    <div class="vt-command-item" onclick="veritheme.toggleCheckbox(this)">

      <div class="vt-checkbox" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" fill="none" class="check-icon" aria-hidden="true">
          <path d="M5 13.2592L7.58583 15.9568C8.2525 16.6523 8.58583 17 9.00004 17C9.41425 17 9.74759 16.6523 10.4143 15.9568L19 7" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="3"></path>
        </svg></div>
      Activity bar
    </div>
    <div class="vt-command-item" onclick="veritheme.toggleCheckbox(this)">

      <div class="vt-checkbox" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" fill="none" class="check-icon" aria-hidden="true">
          <path d="M5 13.2592L7.58583 15.9568C8.2525 16.6523 8.58583 17 9.00004 17C9.41425 17 9.74759 16.6523 10.4143 15.9568L19 7" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="3"></path>
        </svg></div>
      Panel
    </div>
  </div>
</div>

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=&quot;menuitemradio&quot; with aria-checked; veritheme.selectMenuRadio moves the check.

html
Appearance
Light Always light, day and night
Dark Always dark, easier at night
System Follows your device settings
<div class="vt-dropdown-wrap">
  <button class="vt-btn vt-btn-bordered" data-vt-dropdown-trigger="dd-mode">

    Appearance
    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" fill="none" class="vt-w-4 vt-h-4" aria-hidden="true">
      <path d="M18 9.00005C18 9.00005 13.5811 15 12 15C10.4188 15 6 9 6 9" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></path>
    </svg>
  </button>
  <div id="dd-mode" class="vt-dropdown-menu" data-dropdown-content="">
    <div class="vt-dropdown-label">Appearance</div>
    <div class="vt-command-item" role="menuitemradio" aria-checked="false" onclick="veritheme.selectMenuRadio(this)">
      <span class="vt-command-item-content">
        <span class="vt-command-item-title">Light</span>
        <span class="vt-command-item-description">Always light, day and night</span>
      </span>
      <span class="vt-command-item-check vt-command-item-check-end"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" fill="none" aria-hidden="true">
          <path d="M5 13.2592L7.58583 15.9568C8.2525 16.6523 8.58583 17 9.00004 17C9.41425 17 9.74759 16.6523 10.4143 15.9568L19 7" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></path>
        </svg></span>
    </div>
    <div class="vt-command-item" role="menuitemradio" aria-checked="false" onclick="veritheme.selectMenuRadio(this)">
      <span class="vt-command-item-content">
        <span class="vt-command-item-title">Dark</span>
        <span class="vt-command-item-description">Always dark, easier at night</span>
      </span>
      <span class="vt-command-item-check vt-command-item-check-end"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" fill="none" aria-hidden="true">
          <path d="M5 13.2592L7.58583 15.9568C8.2525 16.6523 8.58583 17 9.00004 17C9.41425 17 9.74759 16.6523 10.4143 15.9568L19 7" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></path>
        </svg></span>
    </div>
    <div class="vt-command-item" role="menuitemradio" aria-checked="true" onclick="veritheme.selectMenuRadio(this)">
      <span class="vt-command-item-content">
        <span class="vt-command-item-title">System</span>
        <span class="vt-command-item-description">Follows your device settings</span>
      </span>
      <span class="vt-command-item-check vt-command-item-check-end"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" fill="none" aria-hidden="true">
          <path d="M5 13.2592L7.58583 15.9568C8.2525 16.6523 8.58583 17 9.00004 17C9.41425 17 9.74759 16.6523 10.4143 15.9568L19 7" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></path>
        </svg></span>
    </div>
  </div>
</div>

With Switches

On/off settings: a switch at the end of each row shows its state. The row is the control (role=&quot;menuitemcheckbox&quot; 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.

html
Status bar
Minimap
Word wrap
<div class="vt-dropdown-wrap">
  <button class="vt-btn vt-btn-bordered" data-vt-dropdown-trigger="dd-switch">

    View
    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" fill="none" class="vt-w-4 vt-h-4" aria-hidden="true">
      <path d="M18 9.00005C18 9.00005 13.5811 15 12 15C10.4188 15 6 9 6 9" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></path>
    </svg>
  </button>
  <div id="dd-switch" class="vt-dropdown-menu" data-dropdown-content="">
    <div class="vt-menu-label" role="presentation" id="dd-switch-view">View</div>
    <div role="group" aria-labelledby="dd-switch-view">
      <div class="vt-command-item" role="menuitemcheckbox" aria-checked="true" onclick="veritheme.toggleCheckbox(this)">
        Status bar
        <span class="vt-switch vt-switch-sm vt-active" aria-hidden="true"><span class="vt-switch-thumb"></span></span>
      </div>
      <div class="vt-command-item" role="menuitemcheckbox" aria-checked="false" onclick="veritheme.toggleCheckbox(this)">
        Minimap
        <span class="vt-switch vt-switch-sm" aria-hidden="true"><span class="vt-switch-thumb"></span></span>
      </div>
      <div class="vt-command-item" role="menuitemcheckbox" aria-checked="false" onclick="veritheme.toggleCheckbox(this)">
        Word wrap
        <span class="vt-switch vt-switch-sm" aria-hidden="true"><span class="vt-switch-thumb"></span></span>
      </div>
    </div>
  </div>
</div>

With Radio Items

Menu items with radio buttons for single selection.

html
Density
Comfortable
Compact
Touch
<div class="vt-dropdown-wrap">
  <button class="vt-btn vt-btn-bordered" data-vt-dropdown-trigger="dd-radio">

    Display density
    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" fill="none" class="vt-w-4 vt-h-4" aria-hidden="true">
      <path d="M18 9.00005C18 9.00005 13.5811 15 12 15C10.4188 15 6 9 6 9" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></path>
    </svg>
  </button>
  <div id="dd-radio" class="vt-dropdown-menu" data-dropdown-content="">
    <div class="vt-dropdown-label">Density</div>
    <div class="vt-separator vt-separator-h" role="separator"></div>
    <div class="vt-command-item" onclick="veritheme.selectMenuRadio(this)">

      <div class="vt-radio" aria-hidden="true"><div class="vt-dot"></div></div>
      Comfortable
    </div>
    <div class="vt-command-item" onclick="veritheme.selectMenuRadio(this)">

      <div class="vt-radio selected" aria-hidden="true"><div class="vt-dot"></div></div>
      Compact
    </div>
    <div class="vt-command-item" onclick="veritheme.selectMenuRadio(this)">

      <div class="vt-radio" aria-hidden="true"><div class="vt-dot"></div></div>
      Touch
    </div>
  </div>
</div>

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.

html
Upload a file
Add from Drive
Auto
Manual
<div class="vt-dropdown-wrap">
  <button class="vt-btn vt-btn-ghost" data-vt-dropdown-trigger="dd-place-up">
    Attach
  </button>
  <div id="dd-place-up" class="vt-dropdown-menu vt-dropdown-menu-up" data-dropdown-content="">
    <div class="vt-command-item">
      Upload a file
    </div>
    <div class="vt-command-item">
      Add from Drive
    </div>
  </div>
</div>
<div class="vt-dropdown-wrap">
  <button class="vt-btn vt-btn-bordered" data-vt-dropdown-trigger="dd-place-end">
    Mode
  </button>
  <div id="dd-place-end" class="vt-dropdown-menu vt-dropdown-menu-end vt-dropdown-menu-up" data-dropdown-content="">
    <div class="vt-command-item">
      Auto
    </div>
    <div class="vt-command-item">
      Manual
    </div>
  </div>
</div>

Guidelines

Profile
Settings
Log out
Do Set destructive items apart with the danger style.
United States
Canada
Mexico
Don't Don't use a menu to choose a form value — use a select.

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