Dropdown Menu
A dropdown menu component that displays a list of actions or options when triggered. Supports icons, keyboard shortcuts, and nested submenus. Built on top of bits-ui's DropdownMenu for accessibility and keyboard navigation.
Import
import Dropdown from "$lib/components/Dropdown.svelte"; Basic Usage
A simple dropdown menu with icons and keyboard shortcuts.
Properties
Name
Type
Description
items
Type
DropdownItem[]
Default: []
Array of items to display in the dropdown menu.
triggerLabel
Type
string
Default: ""
Label text for the trigger button.
triggerIcon
Type
string
Default: ""
Material Symbol name for the trigger button (e.g., "expand_more", "menu").
triggerVariant
Type
"outline" | "ghost" | "primary" | "secondary" | "positive" | "destructive" | "brand" | "info" | "blue"
Default: "primary"
Visual style variant for the trigger button.
open
Type
boolean
Default: false
Controls the open state of the dropdown menu.
Item Properties
Name
Type
Description
label
Type
string
Default: -
The text label for the menu item.
icon
Type
string?
Default: -
Optional Material Symbol name for the menu item (e.g., "description", "settings").
kbd
Type
string[]?
Default: -
Optional keyboard shortcut keys to display.
onClick
Type
() => void?
Default: -
Optional click handler for the menu item.
items
Type
DropdownItem[]?
Default: -
Optional submenu items.