Dropdown

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

Usage

Default

<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

Sortable data table
PropTypeDefaultDescription
theme"primary" | "secondary" | "tertiary" | "quaternary" | "clear"Configured DefaultSets the visual theme for the dropdown and menu.
align"left" | "right""right"Menu alignment relative to the toggle button.
toggleOutlinebooleanfalseSets the outline style.
toggleRounding"none" | "small" | "medium" | "large"Configured DefaultRounding style for the dropdown toggle button.
toggleShadow"none" | "light" | "medium" | "strong" | "intense"Configured DefaultShadow style for the dropdown toggle button.
triggerIconReact.ReactNode-Optional icon for the toggle button.
itemsArray<{ label: string; icon?: React.ReactNode; onClick?: () => void; href?: string }>-Dropdown menu items (array of objects).
state"success" | "error" | "warning"-Visual state of the dropdown.
menuRounding"none" | "small" | "medium" | "large"Configured DefaultRounding style for the dropdown menu.
menuShadow"none" | "light" | "medium" | "strong" | "intense"Configured DefaultShadow style for the dropdown menu.
menuClassNamestring-Custom classname for the menu.
ariaLablestring"Dropdown menu"Accessible label.
classNamestring-Custom CSS class for the dropdown container.
data-testidstring"dropdown"Test ID for the component container.