40+ landing page components for ReactBrowse now

Primitives

Dropdown

Contextual menu triggered by a button or other element. Displays a list of actions, links, or options in a floating panel.

Live Demo

Interactive Dropdown

Installation

npm install @trinkui/react

Import

import { Dropdown, DropdownItem } from "@trinkui/react";

Usage

<Dropdown
  trigger={<Button>Options</Button>}
  items={[
    { label: "Edit", icon: <EditIcon />, onClick: handleEdit },
    { label: "Duplicate", icon: <CopyIcon />, onClick: handleDuplicate },
    { divider: true },
    { label: "Archive", icon: <ArchiveIcon />, disabled: true },
    { divider: true },
    { label: "Delete", icon: <TrashIcon />, danger: true, onClick: handleDelete },
  ]}
/>

Alignment

align="start"

align="center"

align="end"

<Dropdown align="start" ... />
<Dropdown align="center" ... />
<Dropdown align="end" ... />

Dropdown Props

PropTypeDefaultDescription
triggerReactNode--Element that toggles the dropdown menu
itemsDropdownItem[]--Array of menu item objects
align"start" | "center" | "end""start"Horizontal alignment of the menu relative to the trigger

DropdownItem Props

PropTypeDefaultDescription
labelstring--Text label for the menu item
iconReactNode--Icon displayed before the label
onClick() => void--Click handler for the item
disabledbooleanfalseDisable the item interaction
dangerbooleanfalseApply destructive/danger styling (red text)
dividerbooleanfalseRender a visual separator instead of an item

Accessibility

  • Trigger element has aria-expanded and aria-haspopup="menu".
  • Menu uses role="menu" with items as role="menuitem".
  • Arrow keys navigate between items; Enter / Space activate the focused item.
  • Escape closes the menu and returns focus to the trigger.
  • Disabled items are skipped during keyboard navigation.