Menu

Dropdown of actions or options opened from a trigger.

Installation

pnpm dlx shadcn@latest add @paneui/menu

Usage

Composition

Examples

Checkbox Items

Radio Items

Disabled and Destructive

Inset

RTL

Keyboard

Arrow keys move the highlight, Enter or Space selects, ArrowRight opens a submenu and ArrowLeft or Esc closes it. Typing a letter jumps to the matching item.

Motion

Popups scale from 95% at the trigger's edge over 200ms. Checkbox and radio indicators pop in with a short scale.

API Reference

Built on the Menu primitive. Only the props this library adds or changes are listed; everything else passes through.

Menu

Re-export of the primitive root. Also accepts every prop of Menu.Root.

open
boolean
Controlled open state.
onOpenChange
(open: boolean, eventDetails) => void
Called when the menu opens or closes.
PropTypeDefaultDescription
openboolean—Controlled open state.
onOpenChange(open: boolean, eventDetails) => void—Called when the menu opens or closes.

MenuTrigger

Re-export. Use render to make a Button the trigger. Also accepts every prop of Menu.Trigger.

MenuContent

Portal, positioner and popup in one. Also accepts every prop of Menu.Popup.

side= "bottom"
"top" | "right" | "bottom" | "left" | "inline-start" | "inline-end"
Side of the trigger to open on.
sideOffset= 6
number
Gap from the trigger in px.
align= "start"
"start" | "center" | "end"
Alignment against the trigger.
alignOffset= 0
number
Shift along the alignment axis in px.
PropTypeDefaultDescription
side"top" | "right" | "bottom" | "left" | "inline-start" | "inline-end""bottom"Side of the trigger to open on.
sideOffsetnumber6Gap from the trigger in px.
align"start" | "center" | "end""start"Alignment against the trigger.
alignOffsetnumber0Shift along the alignment axis in px.

MenuItem

Also accepts every prop of Menu.Item.

variant= "default"
"default" | "destructive"
destructive tints the text, icon and highlight red.
inset= false
boolean
Left padding that matches items with an icon.
disabled= false
boolean
Dim the item and skip it.
closeOnClick= true
boolean
Close the menu when the item is chosen.
PropTypeDefaultDescription
variant"default" | "destructive""default"destructive tints the text, icon and highlight red.
insetbooleanfalseLeft padding that matches items with an icon.
disabledbooleanfalseDim the item and skip it.
closeOnClickbooleantrueClose the menu when the item is chosen.
data-highlighted
Present on the item under the pointer or keyboard focus.
data-variant
default or destructive.
Data attributeDescription
data-highlightedPresent on the item under the pointer or keyboard focus.
data-variantdefault or destructive.

MenuCheckboxItem

Item with a check indicator in the left gutter. Also accepts every prop of Menu.CheckboxItem.

checked
boolean
Controlled checked state.
defaultChecked= false
boolean
Initial state when uncontrolled.
onCheckedChange
(checked: boolean, eventDetails) => void
Called when toggled.
closeOnClick= false
boolean
Close the menu when toggled.
PropTypeDefaultDescription
checkedboolean—Controlled checked state.
defaultCheckedbooleanfalseInitial state when uncontrolled.
onCheckedChange(checked: boolean, eventDetails) => void—Called when toggled.
closeOnClickbooleanfalseClose the menu when toggled.

MenuRadioGroup

Re-export. Holds the selected value for its MenuRadioItems. Also accepts every prop of Menu.RadioGroup.

value
any
Controlled selected value.
defaultValue
any
Initial value when uncontrolled.
onValueChange
(value: any, eventDetails) => void
Called when the selection changes.
PropTypeDefaultDescription
valueany—Controlled selected value.
defaultValueany—Initial value when uncontrolled.
onValueChange(value: any, eventDetails) => void—Called when the selection changes.

MenuRadioItem

Item with a primary dot indicator in the left gutter. Also accepts every prop of Menu.RadioItem.

value*
any
Value selected by this item.
PropTypeDefaultDescription
value*any—Value selected by this item.

MenuGroup

Re-export. Groups items under a MenuLabel. Also accepts every prop of Menu.Group.

MenuLabel

Small muted heading for a group. Must sit inside a MenuGroup. Also accepts every prop of Menu.GroupLabel.

inset= false
boolean
Indent to match inset items.
PropTypeDefaultDescription
insetbooleanfalseIndent to match inset items.

MenuSeparator

Also accepts every prop of Menu.Separator.

MenuShortcut

Right-aligned monospace key hint inside an item. Also accepts every prop of span.

MenuSub

Re-export. Root of a nested menu. Also accepts every prop of Menu.SubmenuRoot.

MenuSubTrigger

Item that opens the submenu, with a trailing chevron. Also accepts every prop of Menu.SubmenuTrigger.

data-popup-open
Present while its submenu is open.
Data attributeDescription
data-popup-openPresent while its submenu is open.

MenuSubContent

MenuContent preset to open on the right, aligned to the trigger item. Also accepts every prop of MenuContent.

side= "right"
same as MenuContent
sideOffset= 4
number
alignOffset= -6
number
Lines the first item up with the trigger.
PropTypeDefaultDescription
sidesame as MenuContent"right"
sideOffsetnumber4
alignOffsetnumber-6Lines the first item up with the trigger.