Introducing PrimeReact v11-alpha 🎉Discover Now

Menu

An unstyled, accessible menu component with compound composition for inline and popup navigation.

Build fully custom navigation menus with complete control over layout and styling.

basic-demo

Pre-styled Versions

Choose a pre-styled library to use Menu with ready-made designs.
For hook-based usage without components, see the Headless API.

Features#

  • Compound component API with sub-components: Root, List, Item, Sub, SubTrigger, SubPortal, SubPositioner, SubPopup, Indicator, Label, Separator, Trigger, Portal, Positioner, Popup, Arrow, RadioGroup
  • Inline and portal-based popup rendering modes
  • Nested submenus with open/close coordination
  • Checkbox and radio item types with indicator matching
  • Built-in character search to jump to items by typing
  • Composite mode for complex nested menus with hover-to-open behavior

Usage#

import { Menu } from 'primereact/menu';
<Menu.Root>
    <Menu.Trigger />
    <Menu.Portal>
        <Menu.Positioner>
            <Menu.Popup>
                <Menu.List>
                    <Menu.Item />
                    <Menu.Sub>
                        <Menu.SubTrigger>
                            <Menu.Indicator />
                        </Menu.SubTrigger>
                        <Menu.SubPortal>
                            <Menu.SubPositioner>
                                <Menu.SubPopup>
                                    <Menu.List>
                                        <Menu.Item />
                                        <Menu.Item />
                                    </Menu.List>
                                </Menu.SubPopup>
                            </Menu.SubPositioner>
                        </Menu.SubPortal>
                    </Menu.Sub>
                </Menu.List>
            </Menu.Popup>
        </Menu.Positioner>
    </Menu.Portal>
</Menu.Root>

Behavior#

Checkbox Items#

Set type="checkbox" on Menu.Item to create a toggleable item. Use Menu.Indicator with match="checked" to display a checkmark when the item is active.

<Menu.Item type="checkbox" defaultChecked={true}>
    <Menu.Indicator match="checked">
        <Check />
    </Menu.Indicator>
    Enable Notifications
</Menu.Item>

Radio Items#

Wrap Menu.Item elements with type="radio" inside a Menu.RadioGroup. Use Menu.Indicator with match="checked" to display a dot or icon for the selected option.

<Menu.RadioGroup defaultValue="light">
    <Menu.Item type="radio" value="light">
        <Menu.Indicator match="checked">
            <Dot />
        </Menu.Indicator>
        Light Mode
    </Menu.Item>
    <Menu.Item type="radio" value="dark">
        <Menu.Indicator match="checked">
            <Dot />
        </Menu.Indicator>
        Dark Mode
    </Menu.Item>
</Menu.RadioGroup>

Motion Animation#

<Menu.Popup motionProps={{ name: 'p-popover' }}></Menu.Popup>

See Motion for animation phases, CSS variables, and hide strategies.

Polymorphic Rendering#

Use as on any sub-component to change the rendered HTML element.

<Menu.Item as="a" href="/dashboard">
    Dashboard
</Menu.Item>

Default elements: Root=div, List=ul, Item=li, Sub=li, SubTrigger=div, SubPositioner=div, SubPopup=div, Trigger=button, Label=li, Separator=li, Indicator=span, Popup=div, Positioner=div, Arrow=div, RadioGroup=div, Portal=portal, SubPortal=portal.

Render Function Children#

Item and SubTrigger accept a render function as children, providing access to the component instance.

<Menu.Item>{(instance) => <span>{instance.focused ? 'Focused' : 'Idle'}</span>}</Menu.Item>

Pass Through#

Some parts may not be visible in the preview depending on the component's current state.

Loading...
/* Select a part to see its CSS selector for custom styling */

API#

NameTypeDefault
refRef<unknown>—
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: MenuRootInstance) => CSSProperties)—
The style to apply to the component.
classNamestring | ((instance?: MenuRootInstance) => string)—
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>—
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceMenuRootInstance—
The instance to pass to the component.
ptSafeRecord<MenuRootPassThrough>—
The pass-through props to pass to the component.
ptOptionsPassThroughOptions—
The pass-through options to pass to the component.
unstyledboolean—
Whether the component should be rendered without classes.
dtunknown—
The design token to use for the component.
stylesStylesOptions<ComponentInstance>—
The styles to use for the component.
render(instance: MenuRootInstance) => ReactNode—
The render function to render the component with instance access.
childrenany—
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
openboolean—
Controlled open state of the menu.
defaultOpenbooleanfalse
Default open state for uncontrolled mode.
compositebooleanfalse
Whether the menu is in composite mode (menubar). In composite mode, submenus open on hover and focusedOptionId is an array tracking the focus path.
appendTo"body" | HTMLElement | "self"'body'
The element to which the overlay is appended.
baseZIndexnumber0
Base zIndex value to use in layering.
autoZIndexbooleantrue
Whether to automatically manage layering.
tabIndexnumber0
Index of the element in tabbing order.
onOpenChange(event: MenuRootOpenChangeEvent) => void—
Callback fired when the menu's open state changes.
[key: string]any—
pt-{optionName}-*-—
Pass through attributes for customizing component. For more info, see Pass Through tab.
AttributeValue
data-scope"menu"
data-part"root"

Defines passthrough(pt) options of Menu component.

labeltypedescription
rootMenuRootPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the root's DOM element.
listMenuRootPassThroughType<HTMLAttributes<HTMLUListElement>>Used to pass attributes to the list's DOM element.
itemMenuRootPassThroughType<HTMLAttributes<HTMLLIElement>>Used to pass attributes to the item's DOM element.
labelMenuRootPassThroughType<HTMLAttributes<HTMLLIElement>>Used to pass attributes to the label's DOM element.
subMenuRootPassThroughType<HTMLAttributes<HTMLLIElement>>Used to pass attributes to the submenu's DOM element.
triggerMenuRootPassThroughType<HTMLAttributes<HTMLButtonElement>>Used to pass attributes to the trigger's DOM element.
subtriggerMenuRootPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the subtrigger's DOM element.
indicatorMenuRootPassThroughType<HTMLAttributes<HTMLSpanElement>>Used to pass attributes to the indicator's DOM element.
separatorMenuRootPassThroughType<HTMLAttributes<HTMLLIElement>>Used to pass attributes to the separator's DOM element.
popupMenuRootPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the popup's DOM element.
arrowMenuRootPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the arrow's DOM element.
positionerMenuRootPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the positioner's DOM element.
subpositionerMenuRootPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the subpositioner's DOM element.
subpopupMenuRootPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the subpopup's DOM element.
subportalMenuRootPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the subportal's DOM element.
NameTypeDefault
refRef<unknown>—
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: MenuTriggerInstance) => CSSProperties)—
The style to apply to the component.
classNamestring | ((instance?: MenuTriggerInstance) => string)—
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>—
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceMenuTriggerInstance—
The instance to pass to the component.
ptSafeRecord<MenuTriggerPassThrough>—
The pass-through props to pass to the component.
ptOptionsPassThroughOptions—
The pass-through options to pass to the component.
unstyledboolean—
Whether the component should be rendered without classes.
dtunknown—
The design token to use for the component.
stylesStylesOptions<ComponentInstance>—
The styles to use for the component.
render(instance: MenuTriggerInstance) => ReactNode—
The render function to render the component with instance access.
childrenany—
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
[key: string]any—
pt-{optionName}-*-—
Pass through attributes for customizing component. For more info, see Pass Through tab.
AttributeValue
data-scope"menu"
data-part"trigger"
data-openPresent when menu is open

Defines passthrough(pt) options of MenuTrigger component.

labeltypedescription
rootMenuTriggerPassThroughType<HTMLAttributes<HTMLButtonElement>>Used to pass attributes to the root's DOM element.
NameTypeDefault
refRef<unknown>—
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: MenuListInstance) => CSSProperties)—
The style to apply to the component.
classNamestring | ((instance?: MenuListInstance) => string)—
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>—
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceMenuListInstance—
The instance to pass to the component.
ptSafeRecord<MenuListPassThrough>—
The pass-through props to pass to the component.
ptOptionsPassThroughOptions—
The pass-through options to pass to the component.
unstyledboolean—
Whether the component should be rendered without classes.
dtunknown—
The design token to use for the component.
stylesStylesOptions<ComponentInstance>—
The styles to use for the component.
render(instance: MenuListInstance) => ReactNode—
The render function to render the component with instance access.
childrenany—
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
[key: string]any—
pt-{optionName}-*-—
Pass through attributes for customizing component. For more info, see Pass Through tab.
AttributeValue
data-scope"menu"
data-part"list"

Defines passthrough(pt) options of MenuList component.

labeltypedescription
rootMenuListPassThroughType<HTMLAttributes<HTMLUListElement>>Used to pass attributes to the root's DOM element.
contentMenuListPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the content's DOM element.
NameTypeDefault
refRef<unknown>—
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: MenuItemInstance) => CSSProperties)—
The style to apply to the component.
classNamestring | ((instance?: MenuItemInstance) => string)—
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>—
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceMenuItemInstance—
The instance to pass to the component.
ptSafeRecord<MenuItemPassThrough>—
The pass-through props to pass to the component.
ptOptionsPassThroughOptions—
The pass-through options to pass to the component.
unstyledboolean—
Whether the component should be rendered without classes.
dtunknown—
The design token to use for the component.
stylesStylesOptions<ComponentInstance>—
The styles to use for the component.
render(instance: MenuItemInstance) => ReactNode—
The render function to render the component with instance access.
childrenany—
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
type"checkbox" | "radio" | "item"—
The type of the menu item.
disabledboolean—
When present, it specifies that the item should be disabled.
valuestring—
Semantic value that uniquely identifies this item within the menu. Used to generate a deterministic DOM id. When not provided, auto-generated. Also used as the radio value when type is 'radio'.
checkedboolean—
Whether the checkbox item is checked or not. Only used when type is 'checkbox'.
defaultCheckedboolean—
Default checked state of the checkbox item. Only used when type is 'checkbox'.
onCheckedChange(event: MenuItemCheckedChangeEvent) => void—
Callback to invoke when checked state changes. Only used when type is 'checkbox'.
[key: string]any—
pt-{optionName}-*-—
Pass through attributes for customizing component. For more info, see Pass Through tab.
AttributeValue
data-scope"menu"
data-part"item"
data-valueThe item value
data-focusedPresent when item is focused
data-disabledPresent when item is disabled
data-checkedPresent when item is checked

Defines passthrough(pt) options of MenuItem component.

labeltypedescription
rootMenuItemPassThroughType<HTMLAttributes<HTMLLIElement>>Used to pass attributes to the root's DOM element.
NameTypeDefault
refRef<unknown>—
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: MenuSubInstance) => CSSProperties)—
The style to apply to the component.
classNamestring | ((instance?: MenuSubInstance) => string)—
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>—
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceMenuSubInstance—
The instance to pass to the component.
ptSafeRecord<MenuSubPassThrough>—
The pass-through props to pass to the component.
ptOptionsPassThroughOptions—
The pass-through options to pass to the component.
unstyledboolean—
Whether the component should be rendered without classes.
dtunknown—
The design token to use for the component.
stylesStylesOptions<ComponentInstance>—
The styles to use for the component.
render(instance: MenuSubInstance) => ReactNode—
The render function to render the component with instance access.
childrenany—
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
openboolean—
Controlled open state of the submenu.
defaultOpenbooleanfalse
Default open state for uncontrolled mode.
valuestring—
Semantic value identifying this submenu. Used to generate deterministic DOM IDs for the submenu trigger and list. When not provided, auto-generated.
disabledbooleanfalse
Whether the submenu is disabled.
onOpenChange(event: MenuSubOpenChangeEvent) => void—
Callback fired when the submenu's open state changes.
[key: string]any—
pt-{optionName}-*-—
Pass through attributes for customizing component. For more info, see Pass Through tab.
AttributeValue
data-scope"menu"
data-part"sub"
data-openPresent when submenu is open

Defines passthrough(pt) options of MenuSub component.

labeltypedescription
rootMenuSubPassThroughType<HTMLAttributes<HTMLLIElement>>Used to pass attributes to the root's DOM element.
NameTypeDefault
refRef<unknown>—
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: MenuSubTriggerInstance) => CSSProperties)—
The style to apply to the component.
classNamestring | ((instance?: MenuSubTriggerInstance) => string)—
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>—
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceMenuSubTriggerInstance—
The instance to pass to the component.
ptSafeRecord<MenuSubTriggerPassThrough>—
The pass-through props to pass to the component.
ptOptionsPassThroughOptions—
The pass-through options to pass to the component.
unstyledboolean—
Whether the component should be rendered without classes.
dtunknown—
The design token to use for the component.
stylesStylesOptions<ComponentInstance>—
The styles to use for the component.
render(instance: MenuSubTriggerInstance) => ReactNode—
The render function to render the component with instance access.
childrenany—
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
[key: string]any—
pt-{optionName}-*-—
Pass through attributes for customizing component. For more info, see Pass Through tab.
AttributeValue
data-scope"menu"
data-part"subtrigger"
data-valueThe subtrigger value
data-focusedPresent when subtrigger is focused
data-disabledPresent when subtrigger is disabled
data-openPresent when submenu is open

Defines passthrough(pt) options of MenuSubTrigger component.

labeltypedescription
rootMenuSubTriggerPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the root's DOM element.
NameTypeDefault
refRef<unknown>—
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: MenuSubPositionerInstance) => CSSProperties)—
The style to apply to the component.
classNamestring | ((instance?: MenuSubPositionerInstance) => string)—
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>—
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceMenuSubPositionerInstance—
The instance to pass to the component.
ptSafeRecord<MenuSubPositionerPassThrough>—
The pass-through props to pass to the component.
ptOptionsPassThroughOptions—
The pass-through options to pass to the component.
unstyledboolean—
Whether the component should be rendered without classes.
dtunknown—
The design token to use for the component.
stylesStylesOptions<ComponentInstance>—
The styles to use for the component.
render(instance: MenuSubPositionerInstance) => ReactNode—
The render function to render the component with instance access.
childrenany—
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
sideSideType—
The side of the positioner.
alignAlignType—
The align of the positioner.
sideOffsetnumber—
The side offset of the positioner.
alignOffsetnumber—
The align offset of the positioner.
flipboolean—
Whether to flip the positioner.
shiftboolean—
Whether to shift the positioner.
hideWhenDetachedboolean—
Whether to hide the positioner when detached.
strategy"fixed" | "absolute"'fixed'
The positioning strategy.
boundaryHTMLElement—
The boundary element that constrains the positioner placement. Used in JS fallback mode only; CSS Anchor mode uses the containing block.
anchorHTMLElement—
The anchor element.
contentHTMLDivElement—
The content element.
arrowHTMLDivElement—
The arrow element.
autoZIndexbooleantrue
Whether to automatically manage layering.
baseZIndexnumber0
Base zIndex value to use in layering.
onPlacementChange(placement: { side: SideType; align: AlignType }) => void—
Callback invoked when the actual placement changes due to flip or shift.
[key: string]any—
pt-{optionName}-*-—
Pass through attributes for customizing component. For more info, see Pass Through tab.
AttributeValue
data-scope"menu"
data-part"subpositioner"

CSS Custom Properties

The positioner element exposes CSS custom properties for layout and transform control.

CSS VariableDescription
--available-heightAvailable vertical space in pixels
--available-widthAvailable horizontal space in pixels
--transform-originComputed transform origin for animations
--positioner-anchor-widthWidth of the anchor/trigger element

Defines passthrough(pt) options of MenuSubPositioner component.

labeltypedescription
rootMenuSubPositionerPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the root's DOM element.
NameTypeDefault
refRef<unknown>—
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
style(CSSProperties | ((instance?: PortalInstance) => CSSProperties)) & (CSSProperties | ((instance?: MenuSubPortalInstance) => CSSProperties))—
The style to apply to the component.
className(string | ((instance?: PortalInstance) => string)) & (string | ((instance?: MenuSubPortalInstance) => string))—
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>—
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceBaseInstance<SafeRecord<PortalProps>, unknown, HTMLElement> & { props: SafeRecord<SafeRecord<PortalProps>>; attrs: Omit<SafeRecord<SafeRecord<PortalProps>>, string | number | symbol> & Record<PropertyKey, unknown> } & { state: SafeRecord; $computedSetup: SafeRecord } & PortalExposes & Record<PropertyKey, unknown> & useComponentPTReturnType & useComponentStyleReturnType & BaseInstance<SafeRecord<MenuSubPortalProps>, unknown, HTMLElement> & { props: SafeRecord<SafeRecord<MenuSubPortalProps>>; attrs: Omit<SafeRecord<SafeRecord<MenuSubPortalProps>>, string | number | symbol> & Record<PropertyKey, unknown> } & { state: SafeRecord; $computedSetup: SafeRecord } & MenuSubPortalExposes—
The instance to pass to the component.
ptPortalPassThrough & Record<PropertyKey, unknown> & MenuSubPortalPassThrough—
The pass-through props to pass to the component.
ptOptionsPassThroughOptions—
The pass-through options to pass to the component.
unstyledboolean—
Whether the component should be rendered without classes.
dtunknown—
The design token to use for the component.
stylesStylesOptions<ComponentInstance>—
The styles to use for the component.
render(instance: PortalInstance) => ReactNode & (instance: MenuSubPortalInstance) => ReactNode—
The render function to render the component with instance access.
childrenany—
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
onMounted() => void—
Callback function to invoke when the portal is mounted.
onUnmounted() => void—
Callback function to invoke when the portal is unmounted.
elementHTMLElement | ReactNode—
The element to be rendered as the portal.
elementRefRefObject<HTMLElement>—
The element reference to be rendered as the portal.
appendTostring | HTMLElement | ((instance: PortalInstance) => HTMLElement)'body'
The DOM element where the portal should be appended to.
[key: string]any—
pt-{optionName}-*-—
Pass through attributes for customizing component. For more info, see Pass Through tab.

Defines passthrough(pt) options of MenuSubPortal component.

labeltypedescription
rootMenuSubPortalPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the root's DOM element.
NameTypeDefault
refRef<unknown>—
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: MenuSubPopupInstance) => CSSProperties)—
The style to apply to the component.
classNamestring | ((instance?: MenuSubPopupInstance) => string)—
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>—
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceMenuSubPopupInstance—
The instance to pass to the component.
ptSafeRecord<MenuSubPopupPassThrough>—
The pass-through props to pass to the component.
ptOptionsPassThroughOptions—
The pass-through options to pass to the component.
unstyledboolean—
Whether the component should be rendered without classes.
dtunknown—
The design token to use for the component.
stylesStylesOptions<ComponentInstance>—
The styles to use for the component.
render(instance: MenuSubPopupInstance) => ReactNode—
The render function to render the component with instance access.
childrenany—
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
motionPropsuseMotionProps—
Used to apply motion to the subpopup element. It accepts the same properties as useMotion hook.
[key: string]any—
pt-{optionName}-*-—
Pass through attributes for customizing component. For more info, see Pass Through tab.
AttributeValue
data-scope"menu"
data-part"subpopup"

Defines passthrough(pt) options of MenuSubPopup component.

labeltypedescription
rootMenuSubPopupPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the root's DOM element.
NameTypeDefault
refRef<unknown>—
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: MenuIndicatorInstance) => CSSProperties)—
The style to apply to the component.
classNamestring | ((instance?: MenuIndicatorInstance) => string)—
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>—
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceMenuIndicatorInstance—
The instance to pass to the component.
ptSafeRecord<MenuIndicatorPassThrough>—
The pass-through props to pass to the component.
ptOptionsPassThroughOptions—
The pass-through options to pass to the component.
unstyledboolean—
Whether the component should be rendered without classes.
dtunknown—
The design token to use for the component.
stylesStylesOptions<ComponentInstance>—
The styles to use for the component.
render(instance: MenuIndicatorInstance) => ReactNode—
The render function to render the component with instance access.
childrenany—
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
match"checked" | "unchecked" | "open" | "closed"—
Determines the visibility of the indicator based on the state of the parent menu element. Valid values are: - "open": Indicator is visible when the submenu is expanded. - "closed": Indicator is visible when the submenu is collapsed. - "checked": Indicator is visible when the checkbox/radio item is checked. - "unchecked": Indicator is visible when the checkbox/radio item is unchecked.
[key: string]any—
pt-{optionName}-*-—
Pass through attributes for customizing component. For more info, see Pass Through tab.
AttributeValue
data-scope"menu"
data-part"indicator"
data-openPresent when submenu is open
data-closedPresent when submenu is closed
data-checkedPresent when item is checked
data-uncheckedPresent when item is unchecked

Defines passthrough(pt) options of MenuIndicator component.

labeltypedescription
rootMenuIndicatorPassThroughType<HTMLAttributes<HTMLSpanElement>>Used to pass attributes to the root's DOM element.
NameTypeDefault
refRef<unknown>—
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: MenuLabelInstance) => CSSProperties)—
The style to apply to the component.
classNamestring | ((instance?: MenuLabelInstance) => string)—
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>—
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceMenuLabelInstance—
The instance to pass to the component.
ptSafeRecord<MenuLabelPassThrough>—
The pass-through props to pass to the component.
ptOptionsPassThroughOptions—
The pass-through options to pass to the component.
unstyledboolean—
Whether the component should be rendered without classes.
dtunknown—
The design token to use for the component.
stylesStylesOptions<ComponentInstance>—
The styles to use for the component.
render(instance: MenuLabelInstance) => ReactNode—
The render function to render the component with instance access.
childrenany—
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
[key: string]any—
pt-{optionName}-*-—
Pass through attributes for customizing component. For more info, see Pass Through tab.
AttributeValue
data-scope"menu"
data-part"label"

Defines passthrough(pt) options of MenuLabel component.

labeltypedescription
rootMenuLabelPassThroughType<HTMLAttributes<HTMLLIElement>>Used to pass attributes to the root's DOM element.
NameTypeDefault
refRef<unknown>—
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: MenuSeparatorInstance) => CSSProperties)—
The style to apply to the component.
classNamestring | ((instance?: MenuSeparatorInstance) => string)—
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>—
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceMenuSeparatorInstance—
The instance to pass to the component.
ptSafeRecord<MenuSeparatorPassThrough>—
The pass-through props to pass to the component.
ptOptionsPassThroughOptions—
The pass-through options to pass to the component.
unstyledboolean—
Whether the component should be rendered without classes.
dtunknown—
The design token to use for the component.
stylesStylesOptions<ComponentInstance>—
The styles to use for the component.
render(instance: MenuSeparatorInstance) => ReactNode—
The render function to render the component with instance access.
childrenany—
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
[key: string]any—
pt-{optionName}-*-—
Pass through attributes for customizing component. For more info, see Pass Through tab.
AttributeValue
data-scope"menu"
data-part"separator"

Defines passthrough(pt) options of MenuSeparator component.

labeltypedescription
rootMenuSeparatorPassThroughType<HTMLAttributes<HTMLLIElement>>Used to pass attributes to the root's DOM element.
NameTypeDefault
refRef<unknown>—
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: MenuRadioGroupInstance) => CSSProperties)—
The style to apply to the component.
classNamestring | ((instance?: MenuRadioGroupInstance) => string)—
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>—
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceMenuRadioGroupInstance—
The instance to pass to the component.
ptSafeRecord<MenuRadioGroupPassThrough>—
The pass-through props to pass to the component.
ptOptionsPassThroughOptions—
The pass-through options to pass to the component.
unstyledboolean—
Whether the component should be rendered without classes.
dtunknown—
The design token to use for the component.
stylesStylesOptions<ComponentInstance>—
The styles to use for the component.
render(instance: MenuRadioGroupInstance) => ReactNode—
The render function to render the component with instance access.
childrenany—
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
valueunknown—
Value of the selected radio item.
defaultValueunknown—
Default value of the selected radio item.
namestring—
Name for the radio group.
onValueChange(event: MenuRadioGroupValueChangeEvent) => void—
Callback to invoke when value changes.
[key: string]any—
AttributeValue
data-scope"menu"
data-part"radiogroup"
NameTypeDefault
refRef<unknown>—
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: MenuPopupInstance) => CSSProperties)—
The style to apply to the component.
classNamestring | ((instance?: MenuPopupInstance) => string)—
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>—
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceMenuPopupInstance—
The instance to pass to the component.
ptSafeRecord<MenuPopupPassThrough>—
The pass-through props to pass to the component.
ptOptionsPassThroughOptions—
The pass-through options to pass to the component.
unstyledboolean—
Whether the component should be rendered without classes.
dtunknown—
The design token to use for the component.
stylesStylesOptions<ComponentInstance>—
The styles to use for the component.
render(instance: MenuPopupInstance) => ReactNode—
The render function to render the component with instance access.
childrenany—
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
motionPropsuseMotionProps—
Used to apply motion to the popup element. It accepts the same properties as useMotion hook.
[key: string]any—
pt-{optionName}-*-—
Pass through attributes for customizing component. For more info, see Pass Through tab.
AttributeValue
data-scope"menu"
data-part"popup"

Defines passthrough(pt) options of MenuPopup component.

labeltypedescription
rootMenuPopupPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the root's DOM element.
NameTypeDefault
refRef<unknown>—
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: MenuPositionerInstance) => CSSProperties)—
The style to apply to the component.
classNamestring | ((instance?: MenuPositionerInstance) => string)—
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>—
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceMenuPositionerInstance—
The instance to pass to the component.
ptSafeRecord<MenuPositionerPassThrough>—
The pass-through props to pass to the component.
ptOptionsPassThroughOptions—
The pass-through options to pass to the component.
unstyledboolean—
Whether the component should be rendered without classes.
dtunknown—
The design token to use for the component.
stylesStylesOptions<ComponentInstance>—
The styles to use for the component.
render(instance: MenuPositionerInstance) => ReactNode—
The render function to render the component with instance access.
childrenany—
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
sideSideType—
The side of the positioner.
alignAlignType—
The align of the positioner.
sideOffsetnumber—
The side offset of the positioner.
alignOffsetnumber—
The align offset of the positioner.
flipboolean—
Whether to flip the positioner.
shiftboolean—
Whether to shift the positioner.
hideWhenDetachedboolean—
Whether to hide the positioner when detached.
strategy"fixed" | "absolute"'fixed'
The positioning strategy.
boundaryHTMLElement—
The boundary element that constrains the positioner placement. Used in JS fallback mode only; CSS Anchor mode uses the containing block.
anchorHTMLElement—
The anchor element.
contentHTMLDivElement—
The content element.
arrowHTMLDivElement—
The arrow element.
autoZIndexbooleantrue
Whether to automatically manage layering.
baseZIndexnumber0
Base zIndex value to use in layering.
onPlacementChange(placement: { side: SideType; align: AlignType }) => void—
Callback invoked when the actual placement changes due to flip or shift.
[key: string]any—
pt-{optionName}-*-—
Pass through attributes for customizing component. For more info, see Pass Through tab.
AttributeValue
data-scope"menu"
data-part"positioner"

CSS Custom Properties

The positioner element exposes CSS custom properties for layout and transform control.

CSS VariableDescription
--available-heightAvailable vertical space in pixels
--available-widthAvailable horizontal space in pixels
--transform-originComputed transform origin for animations
--positioner-anchor-widthWidth of the anchor/trigger element

Defines passthrough(pt) options of MenuPositioner component.

labeltypedescription
rootMenuPositionerPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the root's DOM element.
NameTypeDefault
refRef<unknown>—
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: MenuArrowInstance) => CSSProperties)—
The style to apply to the component.
classNamestring | ((instance?: MenuArrowInstance) => string)—
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>—
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceMenuArrowInstance—
The instance to pass to the component.
ptSafeRecord<MenuArrowPassThrough>—
The pass-through props to pass to the component.
ptOptionsPassThroughOptions—
The pass-through options to pass to the component.
unstyledboolean—
Whether the component should be rendered without classes.
dtunknown—
The design token to use for the component.
stylesStylesOptions<ComponentInstance>—
The styles to use for the component.
render(instance: MenuArrowInstance) => ReactNode—
The render function to render the component with instance access.
childrenany—
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
[key: string]any—
pt-{optionName}-*-—
Pass through attributes for customizing component. For more info, see Pass Through tab.
AttributeValue
data-scope"menu"
data-part"arrow"

CSS Custom Properties

The arrow element exposes CSS custom properties for dynamic positioning:

CSS VariableDescription
--placer-arrow-xHorizontal offset of arrow
--placer-arrow-yVertical offset of arrow
--placer-arrow-leftLeft position of arrow element
--placer-arrow-topTop position of arrow element

Defines passthrough(pt) options of MenuArrow component.

labeltypedescription
rootMenuArrowPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the root's DOM element.
NameTypeDefault
refRef<unknown>—
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
style(CSSProperties | ((instance?: PortalInstance) => CSSProperties)) & (CSSProperties | ((instance?: MenuPortalInstance) => CSSProperties))—
The style to apply to the component.
className(string | ((instance?: PortalInstance) => string)) & (string | ((instance?: MenuPortalInstance) => string))—
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>—
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceBaseInstance<SafeRecord<PortalProps>, unknown, HTMLElement> & { props: SafeRecord<SafeRecord<PortalProps>>; attrs: Omit<SafeRecord<SafeRecord<PortalProps>>, string | number | symbol> & Record<PropertyKey, unknown> } & { state: SafeRecord; $computedSetup: SafeRecord } & PortalExposes & Record<PropertyKey, unknown> & useComponentPTReturnType & useComponentStyleReturnType & BaseInstance<SafeRecord<MenuPortalProps>, unknown, HTMLElement> & { props: SafeRecord<SafeRecord<MenuPortalProps>>; attrs: Omit<SafeRecord<SafeRecord<MenuPortalProps>>, string | number | symbol> & Record<PropertyKey, unknown> } & { state: SafeRecord; $computedSetup: SafeRecord } & MenuPortalExposes—
The instance to pass to the component.
ptPortalPassThrough & Record<PropertyKey, unknown> & MenuPortalPassThrough—
The pass-through props to pass to the component.
ptOptionsPassThroughOptions—
The pass-through options to pass to the component.
unstyledboolean—
Whether the component should be rendered without classes.
dtunknown—
The design token to use for the component.
stylesStylesOptions<ComponentInstance>—
The styles to use for the component.
render(instance: PortalInstance) => ReactNode & (instance: MenuPortalInstance) => ReactNode—
The render function to render the component with instance access.
childrenany—
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
onMounted() => void—
Callback function to invoke when the portal is mounted.
onUnmounted() => void—
Callback function to invoke when the portal is unmounted.
elementHTMLElement | ReactNode—
The element to be rendered as the portal.
elementRefRefObject<HTMLElement>—
The element reference to be rendered as the portal.
appendTostring | HTMLElement | ((instance: PortalInstance) => HTMLElement)'body'
The DOM element where the portal should be appended to.
[key: string]any—
pt-{optionName}-*-—
Pass through attributes for customizing component. For more info, see Pass Through tab.

Defines passthrough(pt) options of MenuPortal component.

labeltypedescription
rootMenuPortalPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the root's DOM element.

Accessibility#

Screen Reader#

Menu component uses the menu role and the value to describe the menu can either be provided with aria-labelledby or aria-label props. Each list item has a menuitem role with aria-label referring to the label of the item and aria-disabled defined if the item is disabled. Checkbox items use menuitemcheckbox and radio items use menuitemradio roles with aria-checked to indicate selection state.

In popup mode, the component implicitly manages the aria-expanded, aria-haspopup and aria-controls attributes of the target element to define the relation between the target and the popup.

Keyboard Support#

KeyFunction
tabAdd focus to the first item if focus moves in to the menu. If the focus is already within the menu, focus moves to the next focusable item in the page tab sequence.
shift + tabAdd focus to the first item if focus moves in to the menu. If the focus is already within the menu, focus moves to the previous focusable item in the page tab sequence.
enterActivates the focused menuitem. If menu is in overlay mode, popup gets closes and focus moves to target.
spaceActivates the focused menuitem. If menu is in overlay mode, popup gets closes and focus moves to target.
escapeIf menu is in overlay mode, popup gets closes and focus moves to target.
down arrowMoves focus to the next menuitem.
up arrowMoves focus to the previous menuitem.
right arrowOpens submenu if focused item has one. Moves focus to the first item of the submenu.
left arrowCloses current submenu and moves focus to parent submenu trigger.
alt + up arrowIf menu is in overlay mode, popup gets closes and focus moves to the target.
homeMoves focus to the first menuitem.
endMoves focus to the last menuitem.