//
A visually persistent menu common in desktop applications that provides quick access to a consistent set of commands.
bun add xiod-ui1import {2 Menubar,3 MenubarCheckboxItem,4 MenubarContent,5 MenubarPopup,6 MenubarGroup,7 MenubarItem,8 MenubarLabel,9 MenubarMenu,10 MenubarPortal,11 MenubarRadioGroup,12 MenubarRadioItem,13 MenubarSeparator,14 MenubarShortcut,15 MenubarSub,16 MenubarSubContent,17 MenubarSubPopup,18 MenubarSubTrigger,19 MenubarTrigger20} from "xiod-ui/menubar";1<Menubar>2 <MenubarSubTrigger />3 <MenubarTrigger />4 <MenubarContent>5 <MenubarLabel />6 <MenubarGroup>7 <MenubarCheckboxItem />8 <MenubarItem />9 <MenubarRadioItem />10 </MenubarGroup>11 <MenubarRadioGroup>12 <MenubarCheckboxItem />13 <MenubarItem />14 <MenubarRadioItem />15 </MenubarRadioGroup>16 <MenubarPopup />17 <MenubarMenu />18 <MenubarPortal />19 <MenubarSeparator />20 <MenubarShortcut />21 <MenubarSub />22 <MenubarSubContent />23 <MenubarSubPopup />24 </MenubarContent>25</Menubar>| Prop | Type | Default | Description |
|---|---|---|---|
modal | boolean| undefined | true | Whether the menubar is modal. |
disabled | boolean| undefined | false | Whether the whole menubar is disabled. |
orientation | MenuRootOrientation| undefined | 'horizontal' | The orientation of the menubar. |
loopFocus | boolean| undefined | true | Whether to loop keyboard focus back to the first item when the end of the list is reached while using the arrow keys. |
className | string| ((state: MenubarState) => string| undefined)| undefined | - | CSS class applied to the element, or a function that returns a class based on the component's state. |
render | ReactElement<unknown, string| JSXElementConstructor<any>>| ComponentRenderFn<HTMLProps, MenubarState>| undefined | - | Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a `ReactElement` or a function that returns the element to render. |
style | CSSProperties| ((state: MenubarState) => CSSProperties| undefined)| undefined | - | Style applied to the element, or a function that returns a style object based on the component's state. |
| Prop | Type | Default | Description |
|---|---|---|---|
checked | boolean| undefined | - | Whether the checkbox item is currently ticked. To render an uncontrolled checkbox item, use the `defaultChecked` prop instead. |
defaultChecked | boolean| undefined | false | Whether the checkbox item is initially ticked. To render a controlled checkbox item, use the `checked` prop instead. |
onCheckedChange | ((checked: boolean, eventDetails: MenuRootChangeEventDetails) => void)| undefined | - | Event handler called when the checkbox item is ticked or unticked. |
onClick | ((event: BaseUIEvent<MouseEvent<HTMLDivElement, MouseEvent>>) => void)| undefined | - | The click handler for the menu item. |
disabled | boolean| undefined | false | Whether the component should ignore user interaction. |
label | string| undefined | - | Overrides the text label to use when the item is matched during keyboard text navigation. |
id | string| undefined | - | @ignore |
closeOnClick | boolean| undefined | false | Whether to close the menu when the item is clicked. |
nativeButton | boolean| undefined | true | Whether the component renders a native `<button>` element when replacing it via the `render` prop. Set to `false` if the rendered element is not a button (for example, `<div>`). |
className | string| ((state: MenuCheckboxItemState) => string| undefined)| undefined | - | CSS class applied to the element, or a function that returns a class based on the component's state. |
render | ReactElement<unknown, string| JSXElementConstructor<any>>| ComponentRenderFn<HTMLProps, MenuCheckboxItemState>| undefined | - | Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a `ReactElement` or a function that returns the element to render. |
style | CSSProperties| ((state: MenuCheckboxItemState) => CSSProperties| undefined)| undefined | - | Style applied to the element, or a function that returns a style object based on the component's state. |
| Prop | Type | Default | Description |
|---|---|---|---|
id | string| undefined | - | @ignore |
finalFocus | boolean| RefObject<HTMLElement| null>| ((closeType: InteractionType) => boolean| void| HTMLElement| null)| undefined | - | 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`, or `keyboard`). Return an element to focus, `true` to use the default behavior, or `false`/`undefined` to do nothing. |
className | string| ((state: MenuPopupState) => string| undefined)| undefined | - | CSS class applied to the element, or a function that returns a class based on the component's state. |
render | ReactElement<unknown, string| JSXElementConstructor<any>>| ComponentRenderFn<HTMLProps, MenuPopupState>| undefined | - | Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a `ReactElement` or a function that returns the element to render. |
style | CSSProperties| ((state: MenuPopupState) => CSSProperties| undefined)| undefined | - | Style applied to the element, or a function that returns a style object based on the component's state. |
align | Align| undefined | start | |
sideOffset | number| OffsetFunction| undefined | 10 | |
alignOffset | number| OffsetFunction| undefined | - | |
side | Side| undefined | - | |
anchor | Element| VirtualElement| RefObject<Element| null>| (() => Element| VirtualElement| null)| null| undefined | - | |
hideArrow | boolean| undefined | false | Whether to hide the arrow indicator. |
| Prop | Type | Default | Description |
|---|---|---|---|
children | ReactNode | - | The content of the component. |
className | string| ((state: MenuGroupState) => string| undefined)| undefined | - | CSS class applied to the element, or a function that returns a class based on the component's state. |
render | ReactElement<unknown, string| JSXElementConstructor<any>>| ComponentRenderFn<HTMLProps, MenuGroupState>| undefined | - | Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a `ReactElement` or a function that returns the element to render. |
style | CSSProperties| ((state: MenuGroupState) => CSSProperties| undefined)| undefined | - | Style applied to the element, or a function that returns a style object based on the component's state. |
| Prop | Type | Default | Description |
|---|---|---|---|
onClick | ((event: BaseUIEvent<MouseEvent<HTMLDivElement, MouseEvent>>) => void)| undefined | - | The click handler for the menu item. |
disabled | boolean| undefined | false | Whether the component should ignore user interaction. |
label | string| undefined | - | Overrides the text label to use when the item is matched during keyboard text navigation. |
id | string| undefined | - | @ignore |
closeOnClick | boolean| undefined | true | Whether to close the menu when the item is clicked. |
nativeButton | boolean| undefined | true | Whether the component renders a native `<button>` element when replacing it via the `render` prop. Set to `false` if the rendered element is not a button (for example, `<div>`). |
className | string| ((state: MenuItemState) => string| undefined)| undefined | - | CSS class applied to the element, or a function that returns a class based on the component's state. |
render | ReactElement<unknown, string| JSXElementConstructor<any>>| ComponentRenderFn<HTMLProps, MenuItemState>| undefined | - | Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a `ReactElement` or a function that returns the element to render. |
style | CSSProperties| ((state: MenuItemState) => CSSProperties| undefined)| undefined | - | Style applied to the element, or a function that returns a style object based on the component's state. |
inset | boolean| undefined | - | |
variant | "default"| "destructive"| undefined | - |
| Prop | Type | Default | Description |
|---|---|---|---|
className | string| ((state: MenuGroupLabelState) => string| undefined)| undefined | - | CSS class applied to the element, or a function that returns a class based on the component's state. |
render | ReactElement<unknown, string| JSXElementConstructor<any>>| ComponentRenderFn<HTMLProps, MenuGroupLabelState>| undefined | - | Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a `ReactElement` or a function that returns the element to render. |
style | CSSProperties| ((state: MenuGroupLabelState) => CSSProperties| undefined)| undefined | - | Style applied to the element, or a function that returns a style object based on the component's state. |
inset | boolean| undefined | - |
| Prop | Type | Default | Description |
|---|---|---|---|
defaultOpen | boolean| undefined | false | Whether the menu is initially open. To render a controlled menu, use the `open` prop instead. |
loopFocus | boolean| undefined | true | Whether to loop keyboard focus back to the first item when the end of the list is reached while using the arrow keys. |
highlightItemOnHover | boolean| undefined | true | Whether moving the pointer over items should highlight them. Disabling this prop allows CSS `:hover` to be differentiated from the `:focus` (`data-highlighted`) state. |
modal | boolean| undefined | true | 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. On touch devices, a `true` modal blocks outside taps but leaves the page scrollable unless the popup spans nearly the full viewport width, matching native iOS behavior. Nested menus ignore this prop, and menus opened by hover are never modal. |
onOpenChange | ((open: boolean, eventDetails: MenuRootChangeEventDetails) => void)| undefined | - | Event handler called when the menu is opened or closed. |
onOpenChangeComplete | ((open: boolean) => void)| undefined | - | Event handler called after any animations complete when the menu is opened or closed. |
open | boolean| undefined | - | Whether the menu is currently open. |
orientation | MenuRootOrientation| undefined | 'vertical' | The visual orientation of the menu. Controls whether roving focus uses up/down or left/right arrow keys. |
disabled | boolean| undefined | false | Whether the component should ignore user interaction. |
closeParentOnEsc | boolean| undefined | false | When in a submenu, determines whether pressing the Escape key closes the entire menu, or only the current child menu. |
actionsRef | RefObject<MenuRootActions| null>| undefined | - | A ref to imperative actions. - `unmount`: Manually unmounts the menu. Call this after any externally controlled closing animation finishes. - `close`: When specified, the menu can be closed imperatively. |
triggerId | string| null| undefined | - | ID of the trigger that the menu is associated with. This is useful in conjunction with the `open` prop to create a controlled menu. There's no need to specify this prop when the menu is uncontrolled (that is, when the `open` prop is not set). |
defaultTriggerId | string| null| undefined | - | ID of the trigger that the menu is associated with. This is useful in conjunction with the `defaultOpen` prop to create an initially open menu. |
handle | MenuHandle<unknown>| undefined | - | A handle to associate the menu with a trigger. If specified, allows external triggers to control the menu's open state. |
children | ReactNode| PayloadChildRenderFunction<unknown> | - | The content of the menu. This can be a regular React node or a render function that receives the `payload` of the active trigger. |
| Prop | Type | Default | Description |
|---|---|---|---|
keepMounted | boolean| undefined | false | Whether to keep the portal mounted in the DOM while the popup is hidden. |
container | HTMLElement| ShadowRoot| RefObject<HTMLElement| ShadowRoot| null>| null| undefined | - | A parent element to render the portal element into. |
className | string| ((state: MenuPortalState) => string| undefined)| undefined | - | CSS class applied to the element, or a function that returns a class based on the component's state. |
render | ReactElement<unknown, string| JSXElementConstructor<any>>| ComponentRenderFn<HTMLProps, MenuPortalState>| undefined | - | Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a `ReactElement` or a function that returns the element to render. |
style | CSSProperties| ((state: MenuPortalState) => CSSProperties| undefined)| undefined | - | Style applied to the element, or a function that returns a style object based on the component's state. |
| Prop | Type | Default | Description |
|---|---|---|---|
children | ReactNode | - | The content of the component. |
value | any | - | The controlled value of the radio item that should be currently selected. To render an uncontrolled radio group, use the `defaultValue` prop instead. |
defaultValue | any | - | The uncontrolled value of the radio item that should be initially selected. To render a controlled radio group, use the `value` prop instead. |
onValueChange | ((value: any, eventDetails: MenuRootChangeEventDetails) => void)| undefined | - | Function called when the selected value changes. |
disabled | boolean| undefined | false | Whether the component should ignore user interaction. |
className | string| ((state: MenuRadioGroupState) => string| undefined)| undefined | - | CSS class applied to the element, or a function that returns a class based on the component's state. |
render | ReactElement<unknown, string| JSXElementConstructor<any>>| ComponentRenderFn<HTMLProps, MenuRadioGroupState>| undefined | - | Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a `ReactElement` or a function that returns the element to render. |
style | CSSProperties| ((state: MenuRadioGroupState) => CSSProperties| undefined)| undefined | - | Style applied to the element, or a function that returns a style object based on the component's state. |
| Prop | Type | Default | Description |
|---|---|---|---|
valueReq | any | - | Value of the radio item. This is the value that will be set in the MenuRadioGroup when the item is selected. |
onClick | ((event: BaseUIEvent<MouseEvent<HTMLDivElement, MouseEvent>>) => void)| undefined | - | The click handler for the menu item. |
disabled | boolean| undefined | false | Whether the component should ignore user interaction. |
label | string| undefined | - | Overrides the text label to use when the item is matched during keyboard text navigation. |
id | string| undefined | - | @ignore |
closeOnClick | boolean| undefined | false | Whether to close the menu when the item is clicked. |
nativeButton | boolean| undefined | true | Whether the component renders a native `<button>` element when replacing it via the `render` prop. Set to `false` if the rendered element is not a button (for example, `<div>`). |
className | string| ((state: MenuRadioItemState) => string| undefined)| undefined | - | CSS class applied to the element, or a function that returns a class based on the component's state. |
render | ReactElement<unknown, string| JSXElementConstructor<any>>| ComponentRenderFn<HTMLProps, MenuRadioItemState>| undefined | - | Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a `ReactElement` or a function that returns the element to render. |
style | CSSProperties| ((state: MenuRadioItemState) => CSSProperties| undefined)| undefined | - | Style applied to the element, or a function that returns a style object based on the component's state. |
| Prop | Type | Default | Description |
|---|---|---|---|
orientation | Orientation| undefined | vertical | The orientation of the separator. |
className | string| ((state: SeparatorState) => string| undefined)| undefined | - | CSS class applied to the element, or a function that returns a class based on the component's state. |
render | ReactElement<unknown, string| JSXElementConstructor<any>>| ComponentRenderFn<HTMLProps, SeparatorState>| undefined | - | Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a `ReactElement` or a function that returns the element to render. |
style | CSSProperties| ((state: SeparatorState) => CSSProperties| undefined)| undefined | - | Style applied to the element, or a function that returns a style object based on the component's state. |
| Prop | Type | Default | Description |
|---|---|---|---|
onOpenChange | ((open: boolean, eventDetails: MenuRootChangeEventDetails) => void)| undefined | - | Event handler called when the menu is opened or closed. |
closeParentOnEsc | boolean| undefined | false | When in a submenu, determines whether pressing the Escape key closes the entire menu, or only the current child menu. |
children | ReactNode | - | The content of the submenu. |
orientation | MenuRootOrientation| undefined | 'vertical' | The visual orientation of the menu. Controls whether roving focus uses up/down or left/right arrow keys. |
disabled | boolean| undefined | false | Whether the component should ignore user interaction. |
actionsRef | RefObject<MenuRootActions| null>| undefined | - | A ref to imperative actions. - `unmount`: Manually unmounts the menu. Call this after any externally controlled closing animation finishes. - `close`: When specified, the menu can be closed imperatively. |
open | boolean| undefined | - | Whether the menu is currently open. |
defaultOpen | boolean| undefined | false | Whether the menu is initially open. To render a controlled menu, use the `open` prop instead. |
onOpenChangeComplete | ((open: boolean) => void)| undefined | - | Event handler called after any animations complete when the menu is opened or closed. |
loopFocus | boolean| undefined | true | Whether to loop keyboard focus back to the first item when the end of the list is reached while using the arrow keys. |
highlightItemOnHover | boolean| undefined | true | Whether moving the pointer over items should highlight them. Disabling this prop allows CSS `:hover` to be differentiated from the `:focus` (`data-highlighted`) state. |
| Prop | Type | Default | Description |
|---|---|---|---|
id | string| undefined | - | @ignore |
finalFocus | boolean| RefObject<HTMLElement| null>| ((closeType: InteractionType) => boolean| void| HTMLElement| null)| undefined | - | 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`, or `keyboard`). Return an element to focus, `true` to use the default behavior, or `false`/`undefined` to do nothing. |
className | string| ((state: MenuPopupState) => string| undefined)| undefined | - | CSS class applied to the element, or a function that returns a class based on the component's state. |
render | ReactElement<unknown, string| JSXElementConstructor<any>>| ComponentRenderFn<HTMLProps, MenuPopupState>| undefined | - | Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a `ReactElement` or a function that returns the element to render. |
style | CSSProperties| ((state: MenuPopupState) => CSSProperties| undefined)| undefined | - | Style applied to the element, or a function that returns a style object based on the component's state. |
| Prop | Type | Default | Description |
|---|---|---|---|
onClick | ((event: BaseUIEvent<MouseEvent<HTMLDivElement, MouseEvent>>) => void)| undefined | - | |
label | string| undefined | - | Overrides the text label to use when the item is matched during keyboard text navigation. |
id | string| undefined | - | @ignore |
disabled | boolean| undefined | false | Whether the component should ignore user interaction. |
delay | number| undefined | 100 | How long to wait before the menu may be opened on hover. Specified in milliseconds. Requires the `openOnHover` prop. |
closeDelay | number| undefined | 0 | How long to wait before closing the menu that was opened on hover. Specified in milliseconds. Requires the `openOnHover` prop. |
openOnHover | boolean| undefined | true | Whether the menu should also open when the trigger is hovered. |
nativeButton | boolean| undefined | true | Whether the component renders a native `<button>` element when replacing it via the `render` prop. Set to `false` if the rendered element is not a button (for example, `<div>`). |
className | string| ((state: MenuSubmenuTriggerState) => string| undefined)| undefined | - | CSS class applied to the element, or a function that returns a class based on the component's state. |
render | ReactElement<unknown, string| JSXElementConstructor<any>>| ComponentRenderFn<HTMLProps, MenuSubmenuTriggerState>| undefined | - | Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a `ReactElement` or a function that returns the element to render. |
style | CSSProperties| ((state: MenuSubmenuTriggerState) => CSSProperties| undefined)| undefined | - | Style applied to the element, or a function that returns a style object based on the component's state. |
inset | boolean| undefined | - |
| Prop | Type | Default | Description |
|---|---|---|---|
disabled | boolean| undefined | false | Whether the component should ignore user interaction. |
handle | MenuHandle<unknown>| undefined | - | A handle to associate the trigger with a menu. |
payload | unknown | - | A payload to pass to the menu when it is opened. |
delay | number| undefined | 100 | How long to wait before the menu may be opened on hover. Specified in milliseconds. Requires the `openOnHover` prop. |
closeDelay | number| undefined | 0 | How long to wait before closing the menu that was opened on hover. Specified in milliseconds. Requires the `openOnHover` prop. |
openOnHover | boolean| undefined | - | Whether the menu should also open when the trigger is hovered. |
nativeButton | boolean| undefined | true | Whether the component renders a native `<button>` element when replacing it via the `render` prop. Set to `false` if the rendered element is not a button (for example, `<div>`). |
className | string| ((state: MenuTriggerState) => string| undefined)| undefined | - | CSS class applied to the element, or a function that returns a class based on the component's state. |
render | ReactElement<unknown, string| JSXElementConstructor<any>>| ComponentRenderFn<HTMLProps, MenuTriggerState>| undefined | - | Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a `ReactElement` or a function that returns the element to render. |
style | CSSProperties| ((state: MenuTriggerState) => CSSProperties| undefined)| undefined | - | Style applied to the element, or a function that returns a style object based on the component's state. |