structyl

Dropdown Menu

stable

Displays a menu to the user — such as a set of actions or functions — triggered by a button.

Basic usage

Examples

With checkboxes and radio items

Toggle options and select an exclusive value inside a dropdown.

Rich action menu

Use labels, separators, checkbox items, radio items and shortcuts in one menu.

Features

  • Can be controlled or uncontrolled.
  • Supports submenus with configurable reading direction.
  • Supports items, labels, groups of items.
  • Supports checkable items (single or multiple).
  • Customize side, alignment, offsets, collision handling.
  • Focus is fully managed; full keyboard navigation; typeahead support.

Installation

bash
pnpm dlx structyl add dropdown-menu

API Reference

Dropdown Menu API reference

Full props, types, defaults, and all 15 parts.

View API

Keyboard interactions

Adheres to the WAI-ARIA design pattern .

KeyDescription
Space / EnterOpens the menu and focuses the first item.
ArrowDown / ArrowUpMoves focus between items.
ArrowRight / ArrowLeftOpens / closes a submenu.
EscCloses the menu and returns focus to the trigger.
Dropdown Menu | structyl