Dropdowns

Dropdowns provide contextual menus, actions, or navigation options in a compact overlay triggered by a button or other interactive element.

Basic Usage

Create a dropdown by combining a trigger element (using slot="trigger") with dropdown items.

Basic Dropdown

100%
Options Edit Duplicate Archive Actions Edit Duplicate Delete

Icons and Rich Content

Enhance dropdown items with icons and different styles to improve visual hierarchy and recognition.

Rich Dropdowns

100%
John Doe
View Profile Settings Sign out
More Edit Duplicate Archive Delete

Positioning

Control where the dropdown menu appears relative to its trigger using the position attribute.

Dropdown Positions

100%
Bottom Left Option 1 Option 2 Bottom Right Option 1 Option 2 Top Left Option 1 Option 2 Top Right Option 1 Option 2

States

Dropdowns support disabled items and can show different states for menu items.

Dropdown States

100%
States Default Item Disabled Item Success Error

Common Patterns

Filter Menu

Filter Menu

100%
Filter All Items Active Archived Deleted

Sort Menu

Sort Menu

100%
Sort Newest First Oldest First Name (A-Z) Name (Z-A)

API Reference

Dropdown Properties

Property Type Default Description position string 'bottom-right' 'bottom-right', 'bottom-left', 'top-right', 'top-left'

Dropdown Item Properties

Property Type Default Description icon string - Icon name to display color string - Color theme for the item disabled boolean false Whether the item is disabled

Events

Event Detail Description open - Fired when the dropdown opens close - Fired when the dropdown closes select { value: string } Fired when an item is selected

Keyboard Navigation

Key Action Enter / Space Open dropdown / Select item Move to previous item Move to next item Esc Close dropdown Tab Close dropdown and move focus

Best Practices

  • Keep dropdown items concise and clear
  • Use icons consistently to improve recognition
  • Group related actions with dividers
  • Position dropdowns to avoid overflow issues
  • Use color to indicate destructive or important actions
  • Ensure proper keyboard navigation support
  • Consider mobile touch targets
Pro tip: Dropdowns will automatically reposition themselves if there isn't enough space in the viewport.