Menu
A list of actions in a dropdown, enhanced with keyboard navigation.
View as MarkdownAnatomy
Import the component and assemble its parts:
Examples
Open on hover
To create a menu that opens on hover, add the openOnHover prop to <Menu.Trigger>. You can additionally configure how quickly the menu opens on hover using the delay prop.
Checkbox items
Use the <Menu.CheckboxItem> part to create a menu item that can toggle a setting on or off.
Radio items
Use the <Menu.RadioGroup> and <Menu.RadioItem> parts to create menu items that work like radio buttons.
Close on click
Use the closeOnClick prop to change whether the menu closes when an item is clicked.
Group labels
Use the <Menu.GroupLabel> part to add a label to a <Menu.Group>
Nested menu
To create a submenu, nest another menu inside the parent menu with <Menu.SubmenuRoot>. Use the <Menu.SubmenuTrigger> part for the menu item that opens the nested menu.
Navigate to another page
Use the <Menu.LinkItem> part to create a link.
Open a dialog
In order to open a dialog using a menu, control the dialog state and open it imperatively using the onClick handler on the menu item.
Detached triggers
A menu can be opened by a trigger that lives either inside or outside the <Menu.Root>.
Keep the trigger inside <Menu.Root> for simple, tightly coupled layouts like the hero demo at the top of this page.
When the trigger and menu content need to live in different parts of the tree (for example, in a card list that controls a menu rendered near the document root), create a handle with Menu.createHandle() and pass it to both the trigger and the root.
Note that only top-level menus can have detached triggers.
Submenus must have their triggers defined within the SubmenuRoot part.
Multiple triggers
One menu can be opened by several triggers.
You can either render multiple <Menu.Trigger> components inside the same <Menu.Root>, or attach several detached triggers to the same handle.
Menus can render different content depending on which trigger opened them.
Pass a payload prop to each <Menu.Trigger> and read it via a function child on <Menu.Root>.
Provide a type argument to createHandle() to strongly type the payload.
Controlled mode with multiple triggers
Control a menu’s open state externally with the open and onOpenChange props on <Menu.Root>.
When more than one trigger can open the menu, track the active trigger with the triggerId prop on <Menu.Root> and matching id props on each <Menu.Trigger>.
The onOpenChange callback receives eventDetails, which includes the DOM element that initiated the change, so you can update your triggerId state when the user activates a different trigger.
Animating the Menu
When one menu is opened by multiple detached triggers, you can animate the menu as it moves between triggers. This includes animating position, size, and content.
Position and Size
To animate the menu’s position, apply CSS transitions to the left, right, top, and bottom properties of the Positioner part.
To animate its size, transition the width and height of the Popup part.
Content
The menu also supports content transitions. This is useful when different triggers display different content within the same menu.
To enable content animations, wrap the menu content in the <Menu.Viewport> part.
This part renders a div with data-activation-direction (left, right, up, or down) so you can make direction-aware animations.
Inside <Menu.Viewport>, content is wrapped in divs with transition data attributes:
data-current: The currently visible content when no transitions are present or the incoming content.data-previous: The outgoing content during a transition.
API reference
Root
Groups all parts of the menu. Doesn’t render its own HTML element.
defaultOpenbooleanfalse
- Name
- Description
Whether the menu is initially open.
To render a controlled menu, use the
openprop instead.- Type
- Default
false
openboolean—
- Name
- Description
Whether the menu is currently open.
- Type
onOpenChangefunction—
- Name
- Description
Event handler called when the menu is opened or closed.
- Type
highlightItemOnHoverbooleantrue
- Description
Whether moving the pointer over items should highlight them. Disabling this prop allows CSS
:hoverto be differentiated from the:focus(data-highlighted) state.- Type
- Default
true
actionsRefReact.RefObject<Menu.Root.Actions | null>—
- Name
- Description
A ref to imperative actions.
unmount: When specified, the menu will not be unmounted when closed. Instead, theunmountfunction must be called to unmount the menu manually. Useful when the menu’s animation is controlled by an external library.close: When specified, the menu can be closed imperatively.
- Type
closeParentOnEscbooleanfalse
- Name
- Description
When in a submenu, determines whether pressing the Escape key closes the entire menu, or only the current child menu.
- Type
- Default
false
defaultTriggerIdstring | null—
- Name
- Description
ID of the trigger that the popover is associated with. This is useful in conjunction with the
defaultOpenprop to create an initially open popover.- Type
handleMenu.Handle<Payload>—
- Name
- Description
A handle to associate the menu with a trigger. If specified, allows external triggers to control the menu’s open state.
- Type
loopFocusbooleantrue
- Name
- Description
Whether to loop keyboard focus back to the first item when the end of the list is reached while using the arrow keys.
- Type
- Default
true
modalbooleantrue
- Name
- Description
Determines if the menu enters a modal state when open.
true: user interaction is limited to the menu: document page scroll is locked and pointer interactions on outside elements are disabled.false: user interaction with the rest of the document is allowed.
- Type
- Default
true
onOpenChangeCompletefunction—
- Description
Event handler called after any animations complete when the menu is closed.
- Type
triggerIdstring | null—
- Name
- Description
ID of the trigger that the popover is associated with. This is useful in conjunction with the
openprop to create a controlled popover. There’s no need to specify this prop when the popover is uncontrolled (that is, when theopenprop is not set).- Type
disabledbooleanfalse
- Name
- Description
Whether the component should ignore user interaction.
- Type
- Default
false
orientationMenu.Root.Orientation'vertical'
- Name
- Description
The visual orientation of the menu. Controls whether roving focus uses up/down or left/right arrow keys.
- Type
- Default
'vertical'
children| React.ReactNode
| PayloadChildRenderFunction<Payload>—
| PayloadChildRenderFunction<Payload>
- Name
- Description
The content of the popover. This can be a regular React node or a render function that receives the
payloadof the active trigger.- Type
Menu.Root.StateHide
Menu.Root.ActionsHide
Menu.Root.ChangeEventReasonHide
Menu.Root.ChangeEventDetailsHide
Menu.Root.OrientationHide
Trigger
A button that opens the menu.
Renders a <button> element.
handleMenu.Handle<Payload>—
- Name
- Description
A handle to associate the trigger with a menu.
- Type
nativeButtonbooleantrue
- Name
- Description
Whether the component renders a native
<button>element when replacing it via therenderprop. Set tofalseif the rendered element is not a button (for example,<div>).- Type
- Default
true
payloadPayload—
- Name
- Description
A payload to pass to the menu when it is opened.
- Type
disabledbooleanfalse
- Name
- Description
Whether the component should ignore user interaction.
- Type
- Default
false
openOnHoverboolean—
- Name
- Description
Whether the menu should also open when the trigger is hovered.
- Type
delaynumber100
- Name
- Description
How long to wait before the menu may be opened on hover. Specified in milliseconds.
Requires the
openOnHoverprop.- Type
- Default
100
closeDelaynumber0
- Name
- Description
How long to wait before closing the menu that was opened on hover. Specified in milliseconds.
Requires the
openOnHoverprop.- Type
- Default
0
childrenReact.ReactNode—
- Name
- Type
classNamestring | function—
- Name
- Description
CSS class applied to the element, or a function that returns a class based on the component’s state.
- Type
styleReact.CSSProperties | function—
- Name
- Description
Style applied to the element, or a function that returns a style object based on the component’s state.
- Type
renderReactElement | function—
- Name
- Description
Allows you to replace the component’s HTML element with a different tag, or compose it with another component.
Accepts a
ReactElementor a function that returns the element to render.- Type
data-popup-open
Present when the corresponding menu is open.
data-pressed
Present when the trigger is pressed.
| Attribute | Description | |
|---|---|---|
data-popup-open | Present when the corresponding menu is open. | |
data-pressed | Present when the trigger is pressed. | |
Menu.Trigger.StateHide
Portal
A portal element that moves the popup to a different part of the DOM.
By default, the portal element is appended to <body>.
Renders a <div> element.
containerUnion—
- Name
- Description
A parent element to render the portal element into.
- Type
classNamestring | function—
- Name
- Description
CSS class applied to the element, or a function that returns a class based on the component’s state.
- Type
styleReact.CSSProperties | function—
- Name
- Description
Style applied to the element, or a function that returns a style object based on the component’s state.
- Type
keepMountedbooleanfalse
- Name
- Description
Whether to keep the portal mounted in the DOM while the popup is hidden.
- Type
- Default
false
renderReactElement | function—
- Name
- Description
Allows you to replace the component’s HTML element with a different tag, or compose it with another component.
Accepts a
ReactElementor a function that returns the element to render.- Type
Menu.Portal.StateHide
Backdrop
An overlay displayed beneath the menu popup.
Renders a <div> element.
classNamestring | function—
- Name
- Description
CSS class applied to the element, or a function that returns a class based on the component’s state.
- Type
styleReact.CSSProperties | function—
- Name
- Description
Style applied to the element, or a function that returns a style object based on the component’s state.
- Type
renderReactElement | function—
- Name
- Description
Allows you to replace the component’s HTML element with a different tag, or compose it with another component.
Accepts a
ReactElementor a function that returns the element to render.- Type
data-open
Present when the menu is open.
data-closed
Present when the menu is closed.
data-starting-style
Present when the menu is animating in.
data-ending-style
Present when the menu is animating out.
| Attribute | Description | |
|---|---|---|
data-open | Present when the menu is open. | |
data-closed | Present when the menu is closed. | |
data-starting-style | Present when the menu is animating in. | |
data-ending-style | Present when the menu is animating out. | |
Menu.Backdrop.StateHide
Positioner
Positions the menu popup against the trigger.
Renders a <div> element.
disableAnchorTrackingbooleanfalse
- Description
Whether to disable the popup from tracking any layout shift of its positioning anchor.
- Type
- Default
false
alignAlign'center'
- Name
- Description
How to align the popup relative to the specified side.
- Type
- Default
'center'
alignOffsetnumber | OffsetFunction0
- Name
- Description
Additional offset along the alignment axis in pixels. Also accepts a function that returns the offset to read the dimensions of the anchor and positioner elements, along with its side and alignment.
The function takes a
dataobject parameter with the following properties:data.anchor: the dimensions of the anchor element with propertieswidthandheight.data.positioner: the dimensions of the positioner element with propertieswidthandheight.data.side: which side of the anchor element the positioner is aligned against.data.align: how the positioner is aligned relative to the specified side.
- Type
- Default
0- Example
sideSide'bottom'
- Name
- Description
Which side of the anchor element to align the popup against. May automatically change to avoid collisions.
- Type
- Default
'bottom'
sideOffsetnumber | OffsetFunction0
- Name
- Description
Distance between the anchor and the popup in pixels. Also accepts a function that returns the distance to read the dimensions of the anchor and positioner elements, along with its side and alignment.
The function takes a
dataobject parameter with the following properties:data.anchor: the dimensions of the anchor element with propertieswidthandheight.data.positioner: the dimensions of the positioner element with propertieswidthandheight.data.side: which side of the anchor element the positioner is aligned against.data.align: how the positioner is aligned relative to the specified side.
- Type
- Default
0- Example
arrowPaddingnumber5
- Name
- Description
Minimum distance to maintain between the arrow and the edges of the popup.
Use it to prevent the arrow element from hanging out of the rounded corners of a popup.
- Type
- Default
5
anchorUnion—
- Name
- Description
An element to position the popup against. By default, the popup will be positioned against the trigger.
- Type
collisionAvoidanceCollisionAvoidance—
- Description
Determines how to handle collisions when positioning the popup.
sidecontrols overflow on the preferred placement axis (top/bottomorleft/right):'flip': keep the requested side when it fits; otherwise try the opposite side (topandbottom, orleftandright).'shift': never change side; keep the requested side and move the popup within the clipping boundary so it stays visible.'none': do not correct side-axis overflow.
aligncontrols overflow on the alignment axis (start/center/end):'flip': keep side, but swapstartandendwhen the requested alignment overflows.'shift': keep side and requested alignment, then nudge the popup along the alignment axis to fit.'none': do not correct alignment-axis overflow.
fallbackAxisSidecontrols fallback behavior on the perpendicular axis when the preferred axis cannot fit:'start': allow perpendicular fallback and try the logical start side first (topbeforebottom, orleftbeforerightin LTR).'end': allow perpendicular fallback and try the logical end side first (bottombeforetop, orrightbeforeleftin LTR).'none': do not fallback to the perpendicular axis.
When
sideis'shift', explicitly settingalignonly supports'shift'or'none'. Ifalignis omitted, it defaults to'flip'.- Type
- Example
collisionBoundaryBoundary'clipping-ancestors'
- Description
An element or a rectangle that delimits the area that the popup is confined to.
- Type
- Default
'clipping-ancestors'
collisionPaddingPadding5
- Name
- Description
Additional space to maintain from the edge of the collision boundary.
- Type
- Default
5
stickybooleanfalse
- Name
- Description
Whether to maintain the popup in the viewport after the anchor element was scrolled out of view.
- Type
- Default
false
positionMethod'absolute' | 'fixed''absolute'
- Name
- Description
Determines which CSS
positionproperty to use.- Type
- Default
'absolute'
classNamestring | function—
- Name
- Description
CSS class applied to the element, or a function that returns a class based on the component’s state.
- Type
styleReact.CSSProperties | function—
- Name
- Description
Style applied to the element, or a function that returns a style object based on the component’s state.
- Type
renderReactElement | function—
- Name
- Description
Allows you to replace the component’s HTML element with a different tag, or compose it with another component.
Accepts a
ReactElementor a function that returns the element to render.- Type
data-open
Present when the menu popup is open.
data-closed
Present when the menu popup is closed.
data-anchor-hidden
Present when the anchor is hidden.
data-align
Indicates how the popup is aligned relative to specified side.
data-side
Indicates which side the popup is positioned relative to the trigger.
| Attribute | Description | |
|---|---|---|
data-open | Present when the menu popup is open. | |
data-closed | Present when the menu popup is closed. | |
data-anchor-hidden | Present when the anchor is hidden. | |
data-align | Indicates how the popup is aligned relative to specified side. | |
data-side | Indicates which side the popup is positioned relative to the trigger. | |
--anchor-height
The anchor’s height.
--anchor-width
The anchor’s width.
--available-height
The available height between the trigger and the edge of the viewport.
--available-width
The available width between the trigger and the edge of the viewport.
--transform-origin
The coordinates that this element is anchored to. Used for animations and transitions.
| CSS Variable | Description | |
|---|---|---|
--anchor-height | The anchor’s height. | |
--anchor-width | The anchor’s width. | |
--available-height | The available height between the trigger and the edge of the viewport. | |
--available-width | The available width between the trigger and the edge of the viewport. | |
--transform-origin | The coordinates that this element is anchored to. Used for animations and transitions. | |
Menu.Positioner.PropsHide
Re-Export of Positioner props as MenuPositionerProps
Menu.Positioner.StateHide
Popup
A container for the menu items.
Renders a <div> element.
finalFocusUnion—
- Name
- Description
Determines the element to focus when the menu is closed.
false: Do not move focus.true: Move focus based on the default behavior (trigger or previously focused element).RefObject: Move focus to the ref element.function: Called with the interaction type (mouse,touch,pen, orkeyboard). Return an element to focus,trueto use the default behavior, orfalse/undefinedto do nothing.
- Type
childrenReact.ReactNode—
- Name
- Type
classNamestring | function—
- Name
- Description
CSS class applied to the element, or a function that returns a class based on the component’s state.
- Type
styleReact.CSSProperties | function—
- Name
- Description
Style applied to the element, or a function that returns a style object based on the component’s state.
- Type
renderReactElement | function—
- Name
- Description
Allows you to replace the component’s HTML element with a different tag, or compose it with another component.
Accepts a
ReactElementor a function that returns the element to render.- Type
data-open
Present when the menu is open.
data-closed
Present when the menu is closed.
data-align
Indicates how the popup is aligned relative to specified side.
data-instant
Present if animations should be instant.
data-side
Indicates which side the popup is positioned relative to the trigger.
data-starting-style
Present when the menu is animating in.
data-ending-style
Present when the menu is animating out.
| Attribute | Description | |
|---|---|---|
data-open | Present when the menu is open. | |
data-closed | Present when the menu is closed. | |
data-align | Indicates how the popup is aligned relative to specified side. | |
data-instant | Present if animations should be instant. | |
data-side | Indicates which side the popup is positioned relative to the trigger. | |
data-starting-style | Present when the menu is animating in. | |
data-ending-style | Present when the menu is animating out. | |
Menu.Popup.StateHide
Viewport
A viewport for displaying content transitions.
This component is only required if one popup can be opened by multiple triggers, its content change based on the trigger
and switching between them is animated.
Renders a <div> element.
childrenReact.ReactNode—
- Name
- Description
The content to render inside the transition container.
- Type
classNamestring | function—
- Name
- Description
CSS class applied to the element, or a function that returns a class based on the component’s state.
- Type
styleReact.CSSProperties | function—
- Name
- Description
Style applied to the element, or a function that returns a style object based on the component’s state.
- Type
renderReactElement | function—
- Name
- Description
Allows you to replace the component’s HTML element with a different tag, or compose it with another component.
Accepts a
ReactElementor a function that returns the element to render.- Type
data-activation-direction
Indicates the direction from which the popup was activated. This can be used to create directional animations based on how the popup was triggered. Contains space-separated values for both horizontal and vertical axes.
data-current
Applied to the direct child of the viewport when no transitions are present or the new content when it’s entering.
data-instant
Present if animations should be instant.
data-previous
Applied to the direct child of the viewport that contains the exiting content when transitions are present.
data-transitioning
Indicates that the viewport is currently transitioning between old and new content.
| Attribute | Description | |
|---|---|---|
data-activation-direction | Indicates the direction from which the popup was activated. This can be used to create directional animations based on how the popup was triggered. Contains space-separated values for both horizontal and vertical axes. | |
data-current | Applied to the direct child of the viewport when no transitions are present or the new content when it’s entering. | |
data-instant | Present if animations should be instant. | |
data-previous | Applied to the direct child of the viewport that contains the exiting content when transitions are present. | |
data-transitioning | Indicates that the viewport is currently transitioning between old and new content. | |
--popup-height
The height of the parent popup. This variable is placed on the ‘previous’ container and stores the height of the popup when the previous content was rendered. It can be used to freeze the dimensions of the popup when animating between different content.
--popup-width
The width of the parent popup. This variable is placed on the ‘previous’ container and stores the width of the popup when the previous content was rendered. It can be used to freeze the dimensions of the popup when animating between different content.
| CSS Variable | Description | |
|---|---|---|
--popup-height | The height of the parent popup. This variable is placed on the ‘previous’ container and stores the height of the popup when the previous content was rendered. It can be used to freeze the dimensions of the popup when animating between different content. | |
--popup-width | The width of the parent popup. This variable is placed on the ‘previous’ container and stores the width of the popup when the previous content was rendered. It can be used to freeze the dimensions of the popup when animating between different content. | |
Menu.Viewport.StateHide
Arrow
Displays an element positioned against the menu anchor.
Renders a <div> element.
classNamestring | function—
- Name
- Description
CSS class applied to the element, or a function that returns a class based on the component’s state.
- Type
styleReact.CSSProperties | function—
- Name
- Description
Style applied to the element, or a function that returns a style object based on the component’s state.
- Type
renderReactElement | function—
- Name
- Description
Allows you to replace the component’s HTML element with a different tag, or compose it with another component.
Accepts a
ReactElementor a function that returns the element to render.- Type
data-open
Present when the menu popup is open.
data-closed
Present when the menu popup is closed.
data-uncentered
Present when the menu arrow is uncentered.
data-align
Indicates how the popup is aligned relative to specified side.
data-side
Indicates which side the popup is positioned relative to the trigger.
| Attribute | Description | |
|---|---|---|
data-open | Present when the menu popup is open. | |
data-closed | Present when the menu popup is closed. | |
data-uncentered | Present when the menu arrow is uncentered. | |
data-align | Indicates how the popup is aligned relative to specified side. | |
data-side | Indicates which side the popup is positioned relative to the trigger. | |
Menu.Arrow.StateHide
Item
An individual interactive item in the menu.
Renders a <div> element.
labelstring—
- Name
- Description
Overrides the text label to use when the item is matched during keyboard text navigation.
- Type
onClickfunction—
- Name
- Description
The click handler for the menu item.
- Type
closeOnClickbooleantrue
- Name
- Description
Whether to close the menu when the item is clicked.
- Type
- Default
true
nativeButtonbooleanfalse
- Name
- Description
Whether the component renders a native
<button>element when replacing it via therenderprop. Set totrueif the rendered element is a native button.- Type
- Default
false
disabledbooleanfalse
- Name
- Description
Whether the component should ignore user interaction.
- Type
- Default
false
classNamestring | function—
- Name
- Description
CSS class applied to the element, or a function that returns a class based on the component’s state.
- Type
styleReact.CSSProperties | function—
- Name
- Description
Style applied to the element, or a function that returns a style object based on the component’s state.
- Type
renderReactElement | function—
- Name
- Description
Allows you to replace the component’s HTML element with a different tag, or compose it with another component.
Accepts a
ReactElementor a function that returns the element to render.- Type
data-highlighted
Present when the menu item is highlighted.
data-disabled
Present when the menu item is disabled.
| Attribute | Description | |
|---|---|---|
data-highlighted | Present when the menu item is highlighted. | |
data-disabled | Present when the menu item is disabled. | |
Menu.Item.StateHide
LinkItem
A link in the menu that can be used to navigate to a different page or section.
Renders an <a> element.
labelstring—
- Name
- Description
Overrides the text label to use when the item is matched during keyboard text navigation.
- Type
closeOnClickbooleanfalse
- Name
- Description
Whether to close the menu when the item is clicked.
- Type
- Default
false
classNamestring | function—
- Name
- Description
CSS class applied to the element, or a function that returns a class based on the component’s state.
- Type
styleReact.CSSProperties | function—
- Name
- Description
Style applied to the element, or a function that returns a style object based on the component’s state.
- Type
renderReactElement | function—
- Name
- Description
Allows you to replace the component’s HTML element with a different tag, or compose it with another component.
Accepts a
ReactElementor a function that returns the element to render.- Type
data-highlighted
Present when the link is highlighted.
| Attribute | Description | |
|---|---|---|
data-highlighted | Present when the link is highlighted. | |
Menu.LinkItem.StateHide
SubmenuRoot
Groups all parts of a submenu. Doesn’t render its own HTML element.
defaultOpenbooleanfalse
- Name
- Description
Whether the menu is initially open.
To render a controlled menu, use the
openprop instead.- Type
- Default
false
openboolean—
- Name
- Description
Whether the menu is currently open.
- Type
onOpenChangefunction—
- Name
- Description
Event handler called when the menu is opened or closed.
- Type
highlightItemOnHoverbooleantrue
- Description
Whether moving the pointer over items should highlight them. Disabling this prop allows CSS
:hoverto be differentiated from the:focus(data-highlighted) state.- Type
- Default
true
actionsRefReact.RefObject<Menu.Root.Actions | null>—
- Name
- Description
A ref to imperative actions.
unmount: When specified, the menu will not be unmounted when closed. Instead, theunmountfunction must be called to unmount the menu manually. Useful when the menu’s animation is controlled by an external library.close: When specified, the menu can be closed imperatively.
- Type
closeParentOnEscbooleanfalse
- Name
- Description
When in a submenu, determines whether pressing the Escape key closes the entire menu, or only the current child menu.
- Type
- Default
false
defaultTriggerIdstring | null—
- Name
- Description
ID of the trigger that the popover is associated with. This is useful in conjunction with the
defaultOpenprop to create an initially open popover.- Type
handleMenu.Handle<unknown>—
- Name
- Description
A handle to associate the menu with a trigger. If specified, allows external triggers to control the menu’s open state.
- Type
loopFocusbooleantrue
- Name
- Description
Whether to loop keyboard focus back to the first item when the end of the list is reached while using the arrow keys.
- Type
- Default
true
onOpenChangeCompletefunction—
- Description
Event handler called after any animations complete when the menu is closed.
- Type
triggerIdstring | null—
- Name
- Description
ID of the trigger that the popover is associated with. This is useful in conjunction with the
openprop to create a controlled popover. There’s no need to specify this prop when the popover is uncontrolled (that is, when theopenprop is not set).- Type
disabledbooleanfalse
- Name
- Description
Whether the component should ignore user interaction.
- Type
- Default
false
orientationMenu.Root.Orientation'vertical'
- Name
- Description
The visual orientation of the menu. Controls whether roving focus uses up/down or left/right arrow keys.
- Type
- Default
'vertical'
children| React.ReactNode
| PayloadChildRenderFunction<unknown>—
| PayloadChildRenderFunction<unknown>
- Name
- Description
The content of the popover. This can be a regular React node or a render function that receives the
payloadof the active trigger.- Type
SubmenuTrigger
A menu item that opens a submenu.
Renders a <div> element.
labelstring—
- Name
- Description
Overrides the text label to use when the item is matched during keyboard text navigation.
- Type
onClickfunction—
- Name
- Type
nativeButtonbooleanfalse
- Name
- Description
Whether the component renders a native
<button>element when replacing it via therenderprop. Set totrueif the rendered element is a native button.- Type
- Default
false
disabledbooleanfalse
- Name
- Description
Whether the component should ignore user interaction.
- Type
- Default
false
openOnHoverboolean—
- Name
- Description
Whether the menu should also open when the trigger is hovered.
- Type
delaynumber100
- Name
- Description
How long to wait before the menu may be opened on hover. Specified in milliseconds.
Requires the
openOnHoverprop.- Type
- Default
100
closeDelaynumber0
- Name
- Description
How long to wait before closing the menu that was opened on hover. Specified in milliseconds.
Requires the
openOnHoverprop.- Type
- Default
0
classNamestring | function—
- Name
- Description
CSS class applied to the element, or a function that returns a class based on the component’s state.
- Type
styleReact.CSSProperties | function—
- Name
- Description
Style applied to the element, or a function that returns a style object based on the component’s state.
- Type
renderReactElement | function—
- Name
- Description
Allows you to replace the component’s HTML element with a different tag, or compose it with another component.
Accepts a
ReactElementor a function that returns the element to render.- Type
data-popup-open
Present when the corresponding submenu is open.
data-highlighted
Present when the submenu trigger is highlighted.
data-disabled
Present when the submenu trigger is disabled.
| Attribute | Description | |
|---|---|---|
data-popup-open | Present when the corresponding submenu is open. | |
data-highlighted | Present when the submenu trigger is highlighted. | |
data-disabled | Present when the submenu trigger is disabled. | |
Group
Groups related menu items with the corresponding label.
Renders a <div> element.
childrenReact.ReactNode—
- Name
- Description
The content of the component.
- Type
classNamestring | function—
- Name
- Description
CSS class applied to the element, or a function that returns a class based on the component’s state.
- Type
styleReact.CSSProperties | function—
- Name
- Description
Style applied to the element, or a function that returns a style object based on the component’s state.
- Type
renderReactElement | function—
- Name
- Description
Allows you to replace the component’s HTML element with a different tag, or compose it with another component.
Accepts a
ReactElementor a function that returns the element to render.- Type
Menu.Group.StateHide
GroupLabel
An accessible label that is automatically associated with its parent group.
Renders a <div> element.
classNamestring | function—
- Name
- Description
CSS class applied to the element, or a function that returns a class based on the component’s state.
- Type
styleReact.CSSProperties | function—
- Name
- Description
Style applied to the element, or a function that returns a style object based on the component’s state.
- Type
renderReactElement | function—
- Name
- Description
Allows you to replace the component’s HTML element with a different tag, or compose it with another component.
Accepts a
ReactElementor a function that returns the element to render.- Type
Menu.GroupLabel.PropsHide
Re-Export of GroupLabel props as MenuGroupLabelProps
Menu.GroupLabel.StateHide
RadioGroup
Groups related radio items.
Renders a <div> element.
defaultValueany—
- Name
- Description
The uncontrolled value of the radio item that should be initially selected.
To render a controlled radio group, use the
valueprop instead.- Type
valueany—
- Name
- Description
The controlled value of the radio item that should be currently selected.
To render an uncontrolled radio group, use the
defaultValueprop instead.- Type
onValueChangefunction—
- Name
- Description
Function called when the selected value changes.
- Type
disabledbooleanfalse
- Name
- Description
Whether the component should ignore user interaction.
- Type
- Default
false
childrenReact.ReactNode—
- Name
- Description
The content of the component.
- Type
classNamestring | function—
- Name
- Description
CSS class applied to the element, or a function that returns a class based on the component’s state.
- Type
styleReact.CSSProperties | function—
- Name
- Description
Style applied to the element, or a function that returns a style object based on the component’s state.
- Type
renderReactElement | function—
- Name
- Description
Allows you to replace the component’s HTML element with a different tag, or compose it with another component.
Accepts a
ReactElementor a function that returns the element to render.- Type
Menu.RadioGroup.PropsHide
Re-Export of RadioGroup props as MenuRadioGroupProps
Menu.RadioGroup.StateHide
Menu.RadioGroup.ChangeEventReasonHide
Menu.RadioGroup.ChangeEventDetailsHide
RadioItem
A menu item that works like a radio button in a given group.
Renders a <div> element.
labelstring—
- Name
- Description
Overrides the text label to use when the item is matched during keyboard text navigation.
- Type
value*—
- Name
- Description
Value of the radio item. This is the value that will be set in the Menu.RadioGroup when the item is selected.
- Type
onClickfunction—
- Name
- Description
The click handler for the menu item.
- Type
closeOnClickbooleanfalse
- Name
- Description
Whether to close the menu when the item is clicked.
- Type
- Default
false
nativeButtonbooleanfalse
- Name
- Description
Whether the component renders a native
<button>element when replacing it via therenderprop. Set totrueif the rendered element is a native button.- Type
- Default
false
disabledbooleanfalse
- Name
- Description
Whether the component should ignore user interaction.
- Type
- Default
false
classNamestring | function—
- Name
- Description
CSS class applied to the element, or a function that returns a class based on the component’s state.
- Type
styleReact.CSSProperties | function—
- Name
- Description
Style applied to the element, or a function that returns a style object based on the component’s state.
- Type
renderReactElement | function—
- Name
- Description
Allows you to replace the component’s HTML element with a different tag, or compose it with another component.
Accepts a
ReactElementor a function that returns the element to render.- Type
data-checked
Present when the menu radio item is selected.
data-unchecked
Present when the menu radio item is not selected.
data-highlighted
Present when the menu radio item is highlighted.
data-disabled
Present when the menu radio item is disabled.
| Attribute | Description | |
|---|---|---|
data-checked | Present when the menu radio item is selected. | |
data-unchecked | Present when the menu radio item is not selected. | |
data-highlighted | Present when the menu radio item is highlighted. | |
data-disabled | Present when the menu radio item is disabled. | |
Menu.RadioItem.StateHide
RadioItemIndicator
Indicates whether the radio item is selected.
Renders a <span> element.
classNamestring | function—
- Name
- Description
CSS class applied to the element, or a function that returns a class based on the component’s state.
- Type
styleReact.CSSProperties | function—
- Name
- Description
Style applied to the element, or a function that returns a style object based on the component’s state.
- Type
keepMountedbooleanfalse
- Name
- Description
Whether to keep the HTML element in the DOM when the radio item is inactive.
- Type
- Default
false
renderReactElement | function—
- Name
- Description
Allows you to replace the component’s HTML element with a different tag, or compose it with another component.
Accepts a
ReactElementor a function that returns the element to render.- Type
data-checked
Present when the menu radio item is selected.
data-unchecked
Present when the menu radio item is not selected.
data-disabled
Present when the menu radio item is disabled.
data-starting-style
Present when the radio indicator is animating in.
data-ending-style
Present when the radio indicator is animating out.
| Attribute | Description | |
|---|---|---|
data-checked | Present when the menu radio item is selected. | |
data-unchecked | Present when the menu radio item is not selected. | |
data-disabled | Present when the menu radio item is disabled. | |
data-starting-style | Present when the radio indicator is animating in. | |
data-ending-style | Present when the radio indicator is animating out. | |
Menu.RadioItemIndicator.PropsHide
Re-Export of RadioItemIndicator props as MenuRadioItemIndicatorProps
Menu.RadioItemIndicator.StateHide
CheckboxItem
A menu item that toggles a setting on or off.
Renders a <div> element.
labelstring—
- Name
- Description
Overrides the text label to use when the item is matched during keyboard text navigation.
- Type
defaultCheckedbooleanfalse
- Name
- Description
Whether the checkbox item is initially ticked.
To render a controlled checkbox item, use the
checkedprop instead.- Type
- Default
false
checkedboolean—
- Name
- Description
Whether the checkbox item is currently ticked.
To render an uncontrolled checkbox item, use the
defaultCheckedprop instead.- Type
onCheckedChangefunction—
- Name
- Description
Event handler called when the checkbox item is ticked or unticked.
- Type
onClickfunction—
- Name
- Description
The click handler for the menu item.
- Type
closeOnClickbooleanfalse
- Name
- Description
Whether to close the menu when the item is clicked.
- Type
- Default
false
nativeButtonbooleanfalse
- Name
- Description
Whether the component renders a native
<button>element when replacing it via therenderprop. Set totrueif the rendered element is a native button.- Type
- Default
false
disabledbooleanfalse
- Name
- Description
Whether the component should ignore user interaction.
- Type
- Default
false
classNamestring | function—
- Name
- Description
CSS class applied to the element, or a function that returns a class based on the component’s state.
- Type
styleReact.CSSProperties | function—
- Name
- Description
Style applied to the element, or a function that returns a style object based on the component’s state.
- Type
renderReactElement | function—
- Name
- Description
Allows you to replace the component’s HTML element with a different tag, or compose it with another component.
Accepts a
ReactElementor a function that returns the element to render.- Type
data-checked
Present when the menu checkbox item is checked.
data-unchecked
Present when the menu checkbox item is not checked.
data-highlighted
Present when the menu checkbox item is highlighted.
data-disabled
Present when the menu checkbox item is disabled.
| Attribute | Description | |
|---|---|---|
data-checked | Present when the menu checkbox item is checked. | |
data-unchecked | Present when the menu checkbox item is not checked. | |
data-highlighted | Present when the menu checkbox item is highlighted. | |
data-disabled | Present when the menu checkbox item is disabled. | |
Menu.CheckboxItem.PropsHide
Re-Export of CheckboxItem props as MenuCheckboxItemProps
Menu.CheckboxItem.StateHide
Menu.CheckboxItem.ChangeEventReasonHide
Menu.CheckboxItem.ChangeEventDetailsHide
CheckboxItemIndicator
Indicates whether the checkbox item is ticked.
Renders a <span> element.
classNamestring | function—
- Name
- Description
CSS class applied to the element, or a function that returns a class based on the component’s state.
- Type
styleReact.CSSProperties | function—
- Name
- Description
Style applied to the element, or a function that returns a style object based on the component’s state.
- Type
keepMountedbooleanfalse
- Name
- Description
Whether to keep the HTML element in the DOM when the checkbox item is not checked.
- Type
- Default
false
renderReactElement | function—
- Name
- Description
Allows you to replace the component’s HTML element with a different tag, or compose it with another component.
Accepts a
ReactElementor a function that returns the element to render.- Type
data-checked
Present when the menu checkbox item is checked.
data-unchecked
Present when the menu checkbox item is not checked.
data-disabled
Present when the menu checkbox item is disabled.
data-starting-style
Present when the indicator is animating in.
data-ending-style
Present when the indicator is animating out.
| Attribute | Description | |
|---|---|---|
data-checked | Present when the menu checkbox item is checked. | |
data-unchecked | Present when the menu checkbox item is not checked. | |
data-disabled | Present when the menu checkbox item is disabled. | |
data-starting-style | Present when the indicator is animating in. | |
data-ending-style | Present when the indicator is animating out. | |
Menu.CheckboxItemIndicator.PropsHide
Re-Export of CheckboxItemIndicator props as MenuCheckboxItemIndicatorProps
Menu.CheckboxItemIndicator.StateHide
Separator
A separator element accessible to screen readers.
Renders a <div> element.
orientationOrientation'horizontal'
- Name
- Description
The orientation of the separator.
- Type
- Default
'horizontal'
classNamestring | function—
- Name
- Description
CSS class applied to the element, or a function that returns a class based on the component’s state.
- Type
styleReact.CSSProperties | function—
- Name
- Description
Style applied to the element, or a function that returns a style object based on the component’s state.
- Type
renderReactElement | function—
- Name
- Description
Allows you to replace the component’s HTML element with a different tag, or compose it with another component.
Accepts a
ReactElementor a function that returns the element to render.- Type
Menu.Separator.StateHide
createHandle
Creates a new handle to connect a Menu.Root with detached Menu.Trigger components.
Return value
Handle
Properties
isOpenreadonly
- Name
- Description
Indicates whether the menu is currently open.
- Type
- Modifiers
readonly
Methods
open(triggerId)
- Name
- Description
Opens the menu and associates it with the trigger with the given id. The trigger must be a Menu.Trigger component with this handle passed as a prop.
- Parameters
triggerId—ID of the trigger to associate with the menu.
- Returns
close()
- Name
- Description
Closes the menu.
- Returns