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 />
    <DropdownMenuRadioGroup>
      <DropdownMenuRadioItem />
      <DropdownMenuRadioItem />
    </DropdownMenuRadioGroup>
    <DropdownMenuSeparator />
    <DropdownMenuSub>
      <DropdownMenuSubTrigger />
      <DropdownMenuContent>
        <DropdownMenuGroup>
          <DropdownMenuItem />
        </DropdownMenuGroup>
      </DropdownMenuContent>
    </DropdownMenuSub>
  </DropdownMenuContent>
</DropdownMenu>

Examples


Default

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

Filtering

Wrap the owning dropdown root or searchable submenu in DropdownMenuFilter. Place the input outside DropdownMenuList, which contains the groups and actions. The list defaults to max-h-75 overflow-x-hidden overflow-y-auto. Add className only when the menu requires different styling.

DropdownMenuFilter forwards Base UI FilterProvider props and uses its defaults. Prefer uncontrolled query state. Pass value and onValueChange when the query also drives application behavior. Use filter={null} when the application renders its own matching rows.

Keep each label inside its DropdownMenuGroup. Filtering automatically hides a group and its label when none of its items match. Clearing the search restores them.

DropdownMenuInput includes native clearing and displays no search icon. Give the input a fixed accessible name.

Base UI renders a filtered popup as a dialog, its input as a searchbox, and its list as a menu. Let the library own these roles and keyboard behavior. The same provider and content work under ContextMenu; wrap each searchable submenu in its own provider.

Checkbox Items

Use DropdownMenuCheckboxItem for toggling options on and off.

Radio Items

Use DropdownMenuRadioGroup and DropdownMenuRadioItem for mutually exclusive options.

API Reference

The root component. Wraps the trigger and content.

The element that toggles the dropdown menu.

PropTypeDefaultDescription
renderReact.ReactElement | (props, state) => React.ReactElement-Renders a custom trigger element and merges trigger props onto it.

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
labelReact.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.
onClickReact.MouseEventHandler<HTMLElement>-Handler called when the item is clicked.

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.

Groups related radio items and manages their mutually exclusive value.

PropTypeDefaultDescription
valueany-The controlled value of the selected radio item.
defaultValueany-The initially selected value when uncontrolled.
onValueChange(value: any, eventDetails) => void-Handler called when the selected value changes.
disabledbooleanfalseWhether the group ignores user interaction.

A menu item representing one value in a DropdownMenuRadioGroup. Extends the shared MenuItem visual props.

PropTypeDefaultDescription
valueany-The value selected when the item is activated.
labelstring-The label text 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.
disabledbooleanfalseWhether the item ignores user interaction.
closeOnClickbooleanfalseWhether selecting the item closes the menu.

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

PropTypeDefaultDescription
titlestring-The group label text.

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.