XiodUI
HomeDocs
OverviewComponentsThemes & ColorsChangelog
⌘ K

Components

  • Accordion
  • Agent Steps
    New
  • Alert
  • Alert Dialog
  • Aspect Ratio
    New
  • Autocomplete
  • Avatar
  • Badge
  • Breadcrumb
  • Button
    Updated
  • Button Group
    New
  • Button Split
    New
  • Calendar
    New
  • Card
  • Carousel
    New
  • Checkbox
  • Circular Progress
    New
  • Collapsible
  • Color Picker
    New
  • Combobox
  • Command
  • Context Menu
    New
  • Copy To Clipboard
    New
  • Corner Badge
    New
  • Dashboard Grid
    New
  • Date Picker
    New
  • Dialog
  • Dot Matrix
    New
  • Draggable
    New
  • Drawer
    New
  • Empty
  • Field
  • Fieldset
  • File Upload
    New
  • Form
  • Frame
  • Gauge
    New
  • Grid
    New
  • Group
  • Input
  • Input Group
  • Input OTP
    New
  • Input Payment
    New
  • Input Phone
    New
  • Input Sensitive
    New
  • Kbd
  • Kinetic Click
    New
  • Label
  • List Box
    New
  • Loader
  • Marker
    New
  • Menu
  • Menubar
  • Message
    New
  • Meter
  • Morphic Toast
    New
  • Navigation Menu
  • Number Field
  • Option Picker
    New
  • Orb
    New
  • Pagination
  • Popover
  • Preview Card
  • Progress
  • Radio
  • Resizable
    New
  • Ruler Picker
    New
  • Scroll Area
  • Scroll Bar
    New
  • Select
  • Separator
  • Sidebar
  • Skeleton
  • Slider
    Updated
  • Sortable
    New
  • Switch
    Updated
  • Table
  • Tabs
  • Text
    New
  • Textarea
  • Timeline
    New
  • Toast
  • Toggle
  • Toggle Group
  • Toolbar
  • Tooltip
    Updated
  • Waveform
    New
  • Wheel Picker
    New
/
/

Loading...

Preview Skeleton

Installation Skeleton

Usage Skeleton

API Reference Skeleton

Sponsors

Support the development of XiodUI and help us build the best component library on Earth.

+++
Sponsor on GitHub

Menubar

Previous: MenuNext: Message

A visually persistent menu common in desktop applications that provides quick access to a consistent set of commands.

Preview

Loading Preview...

Installation

bun add xiod-ui

Usage

Imports

1import {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";

Anatomy

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>

API Reference

Detailed documentation of properties and options.

Menubar

PropTypeDefaultDescription
modal
boolean
|undefined
trueWhether the menubar is modal.
disabled
boolean
|undefined
falseWhether the whole menubar is disabled.
orientation
MenuRootOrientation
|undefined
'horizontal'The orientation of the menubar.
loopFocus
boolean
|undefined
trueWhether 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.

MenubarCheckboxItem

PropTypeDefaultDescription
checked
boolean
|undefined
-Whether the checkbox item is currently ticked. To render an uncontrolled checkbox item, use the `defaultChecked` prop instead.
defaultChecked
boolean
|undefined
falseWhether 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
falseWhether 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
falseWhether to close the menu when the item is clicked.
nativeButton
boolean
|undefined
trueWhether 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.

MenubarPopup

PropTypeDefaultDescription
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
falseWhether to hide the arrow indicator.

MenubarGroup

PropTypeDefaultDescription
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.

MenubarItem

PropTypeDefaultDescription
onClick
((event: BaseUIEvent<MouseEvent<HTMLDivElement, MouseEvent>>) => void)
|undefined
-The click handler for the menu item.
disabled
boolean
|undefined
falseWhether 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
trueWhether to close the menu when the item is clicked.
nativeButton
boolean
|undefined
trueWhether 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
-

MenubarLabel

PropTypeDefaultDescription
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
-

MenubarMenu

PropTypeDefaultDescription
defaultOpen
boolean
|undefined
falseWhether the menu is initially open. To render a controlled menu, use the `open` prop instead.
loopFocus
boolean
|undefined
trueWhether 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
trueWhether 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
trueDetermines 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
falseWhether the component should ignore user interaction.
closeParentOnEsc
boolean
|undefined
falseWhen 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.

MenubarPortal

PropTypeDefaultDescription
keepMounted
boolean
|undefined
falseWhether 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.

MenubarRadioGroup

PropTypeDefaultDescription
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
falseWhether 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.

MenubarRadioItem

PropTypeDefaultDescription
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
falseWhether 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
falseWhether to close the menu when the item is clicked.
nativeButton
boolean
|undefined
trueWhether 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.

MenubarSeparator

PropTypeDefaultDescription
orientation
Orientation
|undefined
verticalThe 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.

MenubarSub

PropTypeDefaultDescription
onOpenChange
((open: boolean, eventDetails: MenuRootChangeEventDetails) => void)
|undefined
-Event handler called when the menu is opened or closed.
closeParentOnEsc
boolean
|undefined
falseWhen 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
falseWhether 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
falseWhether 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
trueWhether 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
trueWhether moving the pointer over items should highlight them. Disabling this prop allows CSS `:hover` to be differentiated from the `:focus` (`data-highlighted`) state.

MenubarSubPopup

PropTypeDefaultDescription
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.

MenubarSubTrigger

PropTypeDefaultDescription
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
falseWhether the component should ignore user interaction.
delay
number
|undefined
100How long to wait before the menu may be opened on hover. Specified in milliseconds. Requires the `openOnHover` prop.
closeDelay
number
|undefined
0How long to wait before closing the menu that was opened on hover. Specified in milliseconds. Requires the `openOnHover` prop.
openOnHover
boolean
|undefined
trueWhether the menu should also open when the trigger is hovered.
nativeButton
boolean
|undefined
trueWhether 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
-

MenubarTrigger

PropTypeDefaultDescription
disabled
boolean
|undefined
falseWhether 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
100How long to wait before the menu may be opened on hover. Specified in milliseconds. Requires the `openOnHover` prop.
closeDelay
number
|undefined
0How 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
trueWhether 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.
MenuMessage