
Dropdown menu with items, separators, and keyboard navigation.
npx shadcn@latest add https://ui.edbn.me/api/analytics/registry/dropdown-menu.jsonGroups all parts of the menu. Doesn't render its own HTML element.
defaultOpenbooleanfalseInitial open state
openbooleanControlled open state
onOpenChange(open, eventDetails) => voidCalled when the menu opens or closes
onOpenChangeComplete(open: boolean) => voidCalled after close animations complete
highlightItemOnHoverbooleantrueHighlight items when the pointer moves over them
actionsRefRefObject<Menu.Root.Actions | null>Imperative close and unmount actions
closeParentOnEscbooleanfalseClose the parent menu when Escape is pressed in a submenu
defaultTriggerIdstring | nullInitial trigger id for an initially open menu
handleMenu.Handle<Payload>Handle for detached triggers
loopFocusbooleantrueLoop keyboard focus through menu items
modalbooleantrueWhether outside interaction is blocked while open
triggerIdstring | nullControlled trigger id for menus with multiple triggers
disabledbooleanfalseIgnore user interaction
orientation'horizontal' | 'vertical''vertical'Roving-focus orientation
childrenReactNode | PayloadChildRenderFunction<Payload>Menu content or render function receiving trigger payload
A button that opens the menu. Renders a button element.
handleMenu.Handle<Payload>Handle that connects this trigger to a detached root
payloadPayloadPayload passed to the root render function when opened
disabledbooleanfalseIgnore user interaction
openOnHoverbooleanAlso open the menu when the trigger is hovered
delaynumber100Hover-open delay in milliseconds
closeDelaynumber0Hover-close delay in milliseconds
nativeButtonbooleantrueWhether a custom render target is a native button
classNamestring | functionCSS class name or state-based class function
styleCSSProperties | functionInline style or state-based style function
renderReactElement | functionCustom render function
| Attribute | Description |
|---|---|
| data-popup-open | Present when the corresponding menu is open |
| data-pressed | Present while the trigger is pressed |
Moves the popup to a different part of the DOM. Renders a div element.
containerHTMLElement | ShadowRoot | RefObject | nullPortal container
keepMountedbooleanfalseKeep the portal mounted while hidden
classNamestring | functionCSS class name
styleCSSProperties | functionInline style or state-based style function
renderReactElement | functionCustom render function
An overlay displayed beneath the menu popup. Renders a div element.
classNamestring | functionCSS class name
styleCSSProperties | functionInline style or state-based style function
renderReactElement | functionCustom render function
| Attribute | Description |
|---|---|
| data-open | Present when the menu is open |
| data-closed | Present when the menu is closed |
| data-starting-style | Present when animating in |
| data-ending-style | Present when animating out |
Positions the menu popup against the trigger. Renders a div element.
side'top' | 'bottom' | 'left' | 'right' | 'inline-start' | 'inline-end''bottom'Preferred side relative to the anchor
sideOffsetnumber | OffsetFunction4Distance from the anchor
align'start' | 'center' | 'end''center'Alignment relative to the side
alignOffsetnumber | OffsetFunction0Offset along the alignment axis
arrowPaddingnumber5Minimum distance between arrow and popup edge
anchorElement | VirtualElement | RefObject | function | nullCustom anchor element
collisionAvoidanceCollisionAvoidanceHow to flip or shift when the popup would overflow
collisionBoundaryBoundary'clipping-ancestors'Boundary used for collision detection
collisionPaddingPadding5Space to preserve from the collision boundary
disableAnchorTrackingbooleanfalseStop tracking anchor layout shifts
stickybooleanfalseKeep popup visible after the anchor scrolls out of view
positionMethod'absolute' | 'fixed''absolute'CSS positioning strategy
classNamestring | functionCSS class name or state-based class function
styleCSSProperties | functionInline style or state-based style function
renderReactElement | functionCustom render function
| Attribute | Description |
|---|---|
| data-open | Present when popup is open |
| data-closed | Present when popup is closed |
| data-anchor-hidden | Present when anchor is hidden |
| data-align | Alignment relative to side |
| data-side | Side popup is positioned on |
| Variable | Description |
|---|---|
| --anchor-height | Anchor height |
| --anchor-width | Anchor width |
| --available-height | Available height |
| --available-width | Available width |
| --transform-origin | Origin used for anchored animations |
A container for the menu items. Renders a div element.
finalFocusboolean | RefObject | functionElement or behavior to focus when the menu closes
childrenReactNodeMenu content
classNamestring | functionCSS class name or state-based class function
styleCSSProperties | functionInline style or state-based style function
renderReactElement | functionCustom render function
| Attribute | Description |
|---|---|
| data-open | Present when menu is open |
| data-closed | Present when menu is closed |
| data-align | Alignment relative to side |
| data-instant | Present when animations should be skipped |
| data-side | Side popup is positioned on |
| data-starting-style | Present when animating in |
| data-ending-style | Present when animating out |
| Variable | Description |
|---|---|
| --popup-height | Current popup height |
| --popup-width | Current popup width |
Displays an arrow element positioned against the menu anchor. Renders a div element.
classNamestring | functionCSS class name
styleCSSProperties | functionInline style or state-based style function
renderReactElement | functionCustom render function
| Attribute | Description |
|---|---|
| data-open | Present when popup is open |
| data-closed | Present when popup is closed |
| data-uncentered | Present when arrow cannot be centered |
| data-align | Alignment relative to side |
| data-side | Side popup is positioned on |
A viewport for displaying animated content transitions between trigger payloads. Renders a div element.
childrenReactNodeContent to render inside the transition container
classNamestring | functionCSS class name
styleCSSProperties | functionInline style or state-based style function
renderReactElement | functionCustom render function
| Attribute | Description |
|---|---|
| data-activation-direction | Direction from previous trigger to new trigger |
| data-current | Applied to the current content container |
| data-instant | Present when animations should be skipped |
| data-previous | Applied to the exiting content container |
| data-transitioning | Present while content is transitioning |
| Variable | Description |
|---|---|
| --popup-height | Parent popup height for transition containers |
| --popup-width | Parent popup width for transition containers |
An individual interactive item in the menu. Renders a div element.
labelstringText label for keyboard typeahead
onClickfunctionClick handler
closeOnClickbooleantrueClose menu when clicked
nativeButtonbooleanfalseWhether a custom render target is a native button
disabledbooleanfalseIgnore user interaction
classNamestring | functionCSS class name
styleCSSProperties | functionInline style or state-based style function
renderReactElement | functionCustom render function
| Attribute | Description |
|---|---|
| data-highlighted | Present when item is highlighted |
| data-disabled | Present when item is disabled |
A link item used to navigate to another page or section. Renders an anchor element.
labelstringText label for keyboard typeahead
closeOnClickbooleanfalseClose menu when clicked
classNamestring | functionCSS class name
styleCSSProperties | functionInline style or state-based style function
renderReactElement | functionCustom render function
| Attribute | Description |
|---|---|
| data-highlighted | Present when link is highlighted |
A separator element accessible to screen readers. Renders a div element.
orientation'horizontal' | 'vertical''horizontal'Separator orientation
classNamestring | functionCSS class name
styleCSSProperties | functionInline style or state-based style function
renderReactElement | functionCustom render function
Groups related menu items with the corresponding label. Renders a div element.
childrenReactNodeGroup contents
classNamestring | functionCSS class name
styleCSSProperties | functionInline style or state-based style function
renderReactElement | functionCustom render function
An accessible label associated with its parent group. Renders a div element.
classNamestring | functionCSS class name
styleCSSProperties | functionInline style or state-based style function
renderReactElement | functionCustom render function
Groups all parts of a submenu. Doesn't render its own HTML element.
defaultOpenbooleanfalseInitial open state
openbooleanControlled open state
onOpenChange(open, eventDetails) => voidCalled when the submenu opens or closes
highlightItemOnHoverbooleantrueHighlight items when hovered
actionsRefRefObject<Menu.Root.Actions | null>Imperative close and unmount actions
closeParentOnEscbooleanfalseClose the parent menu on Escape
defaultTriggerIdstring | nullInitial trigger id
handleMenu.Handle<unknown>Handle for associated triggers
loopFocusbooleantrueLoop keyboard focus
onOpenChangeComplete(open: boolean) => voidCalled after close animations complete
triggerIdstring | nullControlled trigger id
disabledbooleanfalseIgnore user interaction
orientation'horizontal' | 'vertical''vertical'Roving-focus orientation
childrenReactNode | PayloadChildRenderFunction<unknown>Submenu content
A menu item that opens a submenu. Renders a div element.
labelstringText label for keyboard typeahead
onClickfunctionClick handler
nativeButtonbooleanfalseWhether a custom render target is a native button
disabledbooleanfalseIgnore user interaction
openOnHoverbooleanAlso open when hovered
delaynumber100Hover-open delay in milliseconds
closeDelaynumber0Hover-close delay in milliseconds
classNamestring | functionCSS class name
styleCSSProperties | functionInline style or state-based style function
renderReactElement | functionCustom render function
| Attribute | Description |
|---|---|
| data-popup-open | Present when submenu is open |
| data-highlighted | Present when highlighted |
| data-disabled | Present when disabled |
Groups related radio items. Renders a div element.
defaultValueanyInitial selected value
valueanyControlled selected value
onValueChange(value, eventDetails) => voidCalled when selected value changes
disabledbooleanfalseIgnore user interaction
childrenReactNodeRadio item contents
classNamestring | functionCSS class name
styleCSSProperties | functionInline style or state-based style function
renderReactElement | functionCustom render function
A menu item that works like a radio button in a group. Renders a div element.
valueanyrequiredValue selected in the radio group
labelstringText label for keyboard typeahead
onClickfunctionClick handler
closeOnClickbooleanfalseClose menu when clicked
nativeButtonbooleanfalseWhether a custom render target is a native button
disabledbooleanfalseIgnore user interaction
classNamestring | functionCSS class name
styleCSSProperties | functionInline style or state-based style function
renderReactElement | functionCustom render function
| Attribute | Description |
|---|---|
| data-checked | Present when selected |
| data-unchecked | Present when not selected |
| data-highlighted | Present when highlighted |
| data-disabled | Present when disabled |
Indicates whether the radio item is selected. Renders a span element.
keepMountedbooleanfalseKeep the indicator mounted when inactive
classNamestring | functionCSS class name
styleCSSProperties | functionInline style or state-based style function
renderReactElement | functionCustom render function
| Attribute | Description |
|---|---|
| data-checked | Present when selected |
| data-unchecked | Present when not selected |
| data-disabled | Present when disabled |
| data-starting-style | Present when animating in |
| data-ending-style | Present when animating out |
A menu item that toggles a setting on or off. Renders a div element.
labelstringText label for keyboard typeahead
defaultCheckedbooleanfalseInitial checked state
checkedbooleanControlled checked state
onCheckedChange(checked, eventDetails) => voidCalled when checked state changes
onClickfunctionClick handler
closeOnClickbooleanfalseClose menu when clicked
nativeButtonbooleanfalseWhether a custom render target is a native button
disabledbooleanfalseIgnore user interaction
classNamestring | functionCSS class name
styleCSSProperties | functionInline style or state-based style function
renderReactElement | functionCustom render function
| Attribute | Description |
|---|---|
| data-checked | Present when checked |
| data-unchecked | Present when not checked |
| data-highlighted | Present when highlighted |
| data-disabled | Present when disabled |
Indicates whether the checkbox item is checked. Renders a span element.
keepMountedbooleanfalseKeep the indicator mounted when unchecked
classNamestring | functionCSS class name
styleCSSProperties | functionInline style or state-based style function
renderReactElement | functionCustom render function
| Attribute | Description |
|---|---|
| data-checked | Present when checked |
| data-unchecked | Present when not checked |
| data-disabled | Present when disabled |
| data-starting-style | Present when animating in |
| data-ending-style | Present when animating out |
edbn/ui helper exported as MenuShortcut for trailing visual keyboard hints. This is not a Base UI primitive.
classNamestringCSS class name
...spanPropsHTMLAttributes<HTMLSpanElement>Native span attributes
| Attribute | Description |
|---|---|
| data-slot="menu-shortcut" | Stable slot selector for the shortcut helper |
Base UI handle utility for detached triggers and imperative menu control.
isOpenbooleanreadonlyWhether the associated menu is open
open(triggerId: string) => voidmethodOpen and associate the menu with a trigger id
close() => voidmethodClose the associated menu
edbn/ui export that maps to Base UI Menu.createHandle for creating typed detached-trigger handles.
returnMenu.Handle<Payload>A new imperative menu handle