Dropdown Menu

Displays a menu of actions or options that the user can choose from, triggered by a button.

Installation

pnpm add @notion-kit/ui

Anatomy

<DropdownMenu>
  <DropdownMenuTrigger />
  <DropdownMenuContent>
    <DropdownMenuGroup>
      <DropdownMenuLabel />
      <DropdownMenuItem />
      <DropdownMenuItem />
    </DropdownMenuGroup>
    <DropdownMenuSeparator />
    <DropdownMenuSub>
      <DropdownMenuSubTrigger />
      <DropdownMenuSubContent>
        <DropdownMenuGroup>
          <DropdownMenuItem />
        </DropdownMenuGroup>
      </DropdownMenuSubContent>
    </DropdownMenuSub>
  </DropdownMenuContent>
</DropdownMenu>

Examples


Default

A dropdown menu with groups, shortcuts, submenus, and a warning item.

<DropdownMenu><DropdownMenuTrigger asChild>  <Button>Open</Button></DropdownMenuTrigger><DropdownMenuContent>  <DropdownMenuGroup>    <DropdownMenuLabel>My Account</DropdownMenuLabel>    <DropdownMenuItem Body="Profile">      <DropdownMenuShortcut>⇧⌘P</DropdownMenuShortcut>    </DropdownMenuItem>  </DropdownMenuGroup></DropdownMenuContent></DropdownMenu>

Checkbox Items

Use DropdownMenuCheckboxItem for toggling options on and off.

<DropdownMenu><DropdownMenuTrigger asChild>  <Button>Open</Button></DropdownMenuTrigger><DropdownMenuContent>  <DropdownMenuGroup>    <DropdownMenuLabel>Appearance</DropdownMenuLabel>    <DropdownMenuCheckboxItem      checked={showStatusBar}      onCheckedChange={setShowStatusBar}      Body="Status Bar"    />  </DropdownMenuGroup></DropdownMenuContent></DropdownMenu>

API Reference

The root component. Wraps the trigger and content.

The element that toggles the dropdown menu.

PropTypeDefaultDescription
asChildboolean-Merges props onto the child element instead of rendering a wrapper.

The popover panel that appears when the menu is open.

PropTypeDefaultDescription
sideOffsetnumber4Distance in pixels from the trigger.

A single actionable item in the menu. Extends the shared MenuItem props.

PropTypeDefaultDescription
BodyReact.ReactNode-The label text or content of the item.
IconReact.ReactNode-An optional leading icon.
descstring-An optional description below the label.
variant"default" | "secondary" | "sidebar" | "warning" | "error""default"The visual style of the item.
disabledboolean-Whether the item is disabled.
onSelect(event: Event) => void-Handler called when the item is selected.

A menu item that can be toggled on and off. Extends DropdownMenuItem props.

PropTypeDefaultDescription
checkedboolean-Whether the item is checked.
onCheckedChange(checked: boolean) => void-Handler called when the checked state changes.

A non-interactive label used to title a group of items.

A visual divider between groups of items.

Displays a keyboard shortcut hint aligned to the right of an item.

Groups related menu items together with consistent spacing.

Wraps a sub-menu trigger and its content.

A menu item that opens a sub-menu. Accepts the same props as DropdownMenuItem.

The popover panel for a sub-menu.