Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

DropdownMenu

A Radix-backed action menu with leading icons, Kbd shortcut hints, and a danger ramp for destructive items — composed via statics.

Import

import { Bell, Users, X } from "@roger-emerson/ploxum-icons";
import { Button, DropdownMenu, Icon } from "@roger-emerson/ploxum-primitives";

Usage

<DropdownMenu>
  <DropdownMenu.Trigger asChild>
    <Button variant="ghost">Incident actions</Button>
  </DropdownMenu.Trigger>
  <DropdownMenu.Content width={220}>
    <DropdownMenu.Label>INC-2041 — Gate 4</DropdownMenu.Label>
    <DropdownMenu.Item icon={<Icon decorative icon={Users} />} onSelect={assign} shortcut="A">
      Assign to me
    </DropdownMenu.Item>
    <DropdownMenu.Item icon={<Icon decorative icon={Bell} />} onSelect={snooze}>
      Snooze 15 min
    </DropdownMenu.Item>
    <DropdownMenu.Separator />
    <DropdownMenu.Item destructive icon={<Icon decorative icon={X} />} onSelect={discard}>
      Discard incident
    </DropdownMenu.Item>
  </DropdownMenu.Content>
</DropdownMenu>

Props

DropdownMenu (root)

PropTypeDefaultDescription
openbooleanControlled open state.
defaultOpenbooleanUncontrolled initial state.
onOpenChange(open: boolean) => voidOpen-state callback.
childrenReactNodeTrigger + Content.

DropdownMenu.Trigger

Radix Trigger passthrough — use asChild to wrap your own Button.

DropdownMenu.Content

PropTypeDefaultDescription
align"start" | "center" | "end""start"Alignment relative to the trigger.
sideOffsetnumber6Gap from the trigger in px.
widthnumberFixed width in px. Defaults to content-sized with a 180px floor.
classNamestringMerged onto the panel.

Also accepts the remaining Radix DropdownMenu.Content props (side, collisionPadding, …).

DropdownMenu.Item

PropTypeDefaultDescription
onSelect(event: Event) => voidFires on selection (click or Enter).
iconReactNodeLeading icon. Inherits the item's text color, including danger on destructive items.
shortcutstringKeyboard shortcut hint, rendered right-aligned in a Kbd.
destructivebooleanRenders the item in the danger ramp. Always pair with icon.
disabledbooleanDims the item and removes it from pointer/keyboard flow.
classNamestringMerged onto the item.

DropdownMenu.Separator / DropdownMenu.Label

Both take only className (Label also takes children). Label renders the uppercase tertiary group heading.

Design rules

  • Destructive items must pair destructive with an icon — the danger state reads by shape as well as color.
  • shortcut is a hint chip only; the menu does not bind the key. Register the actual handler where the command lives (usually the CommandPalette's action map).
  • The panel animates a 200ms fade/scale on the cubic-bezier(0.25, 1, 0.5, 1) ease — within the motion budget, no spring. Don't extend it.
  • DropdownMenu is a menu: focus moves into it and returns on close. For non-modal anchored surfaces that must not trap focus, use Popover (heuristic 9).

Storybook

Open DropdownMenu in Storybook ↗