Dropdown

The Dropdown component provides a menu for users to select from options, with customizable appearance, alignment, and items.

Usage & Examples

Default

default.tsx
<Dropdown
  items={[
    { label: "Profile", icon: <FaUser />, onClick: () => alert("View Profile") },
    { label: "Settings", icon: <FaCog />, onClick: () => alert("Settings clicked") },
    { label: "Logout", icon: <FaSignOutAlt />, onClick: () => alert("Logged out"), "data-testid": "logout-button" },
  ]}
/>

Props API

26 props
Columns
Dropdown props API
Default
Description
align"left" | "right"Noprops"right"Menu alignment relative to the trigger ('left' | 'right').
aria-describedbystringNoariaAccessible description id(s) for the trigger button.
aria-labelstringNoaria"Dropdown menu"Accessible label for the trigger button. Prefer this when the trigger is icon-only.
aria-labelledbystringNoariaAccessible labelledby target for the trigger button.
classNamestringNostylingCustom class name for the dropdown wrapper.
closeOnSelectbooleanNopropstrueWhether the menu should close after selecting an item. Default is usually true for action menus.
data-testidstringNotestingBackward-compatible alias for test ID attributes.
focusFirstItemOnOpenbooleanNopropstrueWhether keyboard focus should move to the first item when the menu opens. Default behavior in your base already does this logically.
glassbooleanNopropsconfigured default glass setting (fallback: false)Adds glass styling to the trigger IconButton and dropdown menu.
itemsDropdownItem[]YespropsArray of items to render in the dropdown menu.
menuAriaDescribedbystringNopropsAccessible description id(s) for the menu.
menuAriaLabelstringNopropsAccessible label for the menu itself. Falls back to `aria-label` in many implementations.