Skip to content
All components
Overlays

Menubar

Give a desktop-style application a persistent row of command menus (File, Edit, View) that work like the menu bar of a native app.

A persistent application menu bar.

Installation

tdpxl is not an npm dependency of your app. The @tdpxl/cli command (not published to npm yet) copies the source into your project, with the registry items and npm packages it imports.

npx @tdpxl/cli add menubar

Then import it from @/components/ui/menubar. New project? Start with the installation guide.

Examples

Each example is one branch of the official demo, rendered in its own frame. The code is that branch as you would write it, with imports pointing at the default install paths.

Submenu and shortcuts

Nest related commands in submenus and show shortcut hints. Arrow Right opens a submenu, Arrow Left returns, and the disabled item is skipped; shortcut text does not bind keys.

"use client"

import {
  Menubar,
  MenubarContent,
  MenubarItem,
  MenubarMenu,
  MenubarSeparator,
  MenubarShortcut,
  MenubarSub,
  MenubarSubContent,
  MenubarSubTrigger,
  MenubarTrigger,
} from "@/components/ui/menubar"

export function MenubarSubmenuAndShortcuts() {
  
  
  
  
  
  
  return (
    <div className="flex flex-col items-start gap-6">
      <Menubar>
        <MenubarMenu>
          <MenubarTrigger>Edit</MenubarTrigger>
          <MenubarContent>
            <MenubarItem>
              Undo
              <MenubarShortcut>Ctrl Z</MenubarShortcut>
            </MenubarItem>
            <MenubarItem disabled>
              Redo
              <MenubarShortcut>Ctrl Y</MenubarShortcut>
            </MenubarItem>
            <MenubarSeparator />
            <MenubarSub>
              <MenubarSubTrigger>Find</MenubarSubTrigger>
              <MenubarSubContent>
                <MenubarItem>
                  Find...
                  <MenubarShortcut>Ctrl F</MenubarShortcut>
                </MenubarItem>
                <MenubarItem>Find next</MenubarItem>
                <MenubarItem>Replace...</MenubarItem>
              </MenubarSubContent>
            </MenubarSub>
          </MenubarContent>
        </MenubarMenu>
        <MenubarMenu>
          <MenubarTrigger>Share</MenubarTrigger>
          <MenubarContent>
            <MenubarItem>Copy link</MenubarItem>
            <MenubarSub>
              <MenubarSubTrigger>Export as</MenubarSubTrigger>
              <MenubarSubContent>
                <MenubarItem>PDF document</MenubarItem>
                <MenubarItem>Plain text</MenubarItem>
              </MenubarSubContent>
            </MenubarSub>
          </MenubarContent>
        </MenubarMenu>
      </Menubar>
    </div>
  )
}

Controlled selection

Own checkbox and radio menu choices in parent state. The text below the bar reflects every change, showing that the consumer stores and applies the setting.

"use client"

import * as React from "react"

import {
  Menubar,
  MenubarCheckboxItem,
  MenubarContent,
  MenubarMenu,
  MenubarRadioGroup,
  MenubarRadioItem,
  MenubarSeparator,
  MenubarTrigger,
} from "@/components/ui/menubar"

export function MenubarControlledSelection() {
  
  
  
  const [lineNumbers, setLineNumbers] = React.useState(true)
  const [wrapLines, setWrapLines] = React.useState(false)
  const [fontSize, setFontSize] = React.useState("medium")
  return (
    <div className="flex flex-col items-start gap-6">
      <div className="flex flex-col items-start gap-2">
        <Menubar>
          <MenubarMenu>
            <MenubarTrigger>Appearance</MenubarTrigger>
            <MenubarContent>
              <MenubarCheckboxItem checked={lineNumbers} onCheckedChange={setLineNumbers}>
                Line numbers
              </MenubarCheckboxItem>
              <MenubarCheckboxItem checked={wrapLines} onCheckedChange={setWrapLines}>
                Wrap long lines
              </MenubarCheckboxItem>
              <MenubarSeparator />
              <MenubarRadioGroup value={fontSize} onValueChange={setFontSize}>
                <MenubarRadioItem value="small">Small text</MenubarRadioItem>
                <MenubarRadioItem value="medium">Medium text</MenubarRadioItem>
                <MenubarRadioItem value="large">Large text</MenubarRadioItem>
              </MenubarRadioGroup>
            </MenubarContent>
          </MenubarMenu>
        </Menubar>
        <p className="text-paragraph-sm text-sub-600">
          Line numbers {lineNumbers ? "on" : "off"}, wrapping {wrapLines ? "on" : "off"}, {fontSize} text.
        </p>
      </div>
    </div>
  )
}

Destructive item

Separate a destructive command and align inset items. intent error only styles the item; a real app confirms the deletion before running it.

"use client"

import {
  Menubar,
  MenubarContent,
  MenubarGroup,
  MenubarItem,
  MenubarMenu,
  MenubarSeparator,
  MenubarTrigger,
} from "@/components/ui/menubar"

export function MenubarDestructiveItem() {
  
  
  
  
  
  
  return (
    <div className="flex flex-col items-start gap-6">
      <Menubar>
        <MenubarMenu>
          <MenubarTrigger>Project</MenubarTrigger>
          <MenubarContent>
            <MenubarGroup>
              <MenubarItem inset>Rename...</MenubarItem>
              <MenubarItem inset>Duplicate</MenubarItem>
              <MenubarItem inset>Move to folder...</MenubarItem>
            </MenubarGroup>
            <MenubarSeparator />
            <MenubarItem inset intent="error">
              Delete project...
            </MenubarItem>
          </MenubarContent>
        </MenubarMenu>
      </Menubar>
    </div>
  )
}

API reference

Generated from the component's TypeScript signatures. Inherited DOM and primitive props are listed separately.

Menubar

Expose persistent application-style menus and their commands.

Menubar props
PropTypeDefaultDescription
inputMode"search" | "text" | "none" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined—Hints at the type of data that might be entered by the user while editing the element or its contents
aria-describedbystring | undefined—Identifies the element (or elements) that describes the object.
aria-invalidboolean | "false" | "true" | "grammar" | "spelling" | undefined—Indicates the entered value does not conform to the format expected by the application.
aria-labelstring | undefined—Defines a string value that labels the current element.
aria-labelledbystring | undefined—Identifies the element (or elements) that labels the current element.
childrenReact.ReactNode—Represents all of the things React can render.
Inherited props (18)
Menubar inherited props
PropTypeDefaultDescription
valuestring | undefined—Current value in the shape defined by the source type. For controlled interactive inputs, apply updates from the change callback.
defaultValuestring | undefined—Initial value for a control supporting uncontrolled state. Inherited DOM typing alone does not give a layout wrapper input behavior.
onValueChange((value: string) => void) | undefined—Receive the next value in the source-defined shape. A controlled parent must apply it to value.
loopboolean | undefined—Allow keyboard navigation to wrap between the first and last eligible items.
dir("ltr" | "rtl") | undefined—Reading direction used by the primitive. Keep it consistent with the surrounding content and Direction provider.
classNamestring | undefined—Additional classes for this part. Preserve contrast, visible focus and responsive content when adapting styles.
defaultCheckedboolean | undefined—Initial checked state for a control supporting uncontrolled selection. Inherited DOM typing does not give a layout wrapper checkbox behavior.
autoFocusboolean | undefined—Request automatic focus when the element mounts or the primitive opens, according to its source behavior. Choose initial focus deliberately in context.
idstring | undefined—Stable DOM identifier used by labels, descriptions or other explicit associations.
roleReact.AriaRole | undefined—Semantic role appropriate to the rendered element. Preserve required relationships and keyboard behavior.
onFocusReact.FocusEventHandler<HTMLDivElement> | undefined—Receive the native focus event. Preserve the component's existing keyboard and focus behavior.
onBlurReact.FocusEventHandler<HTMLDivElement> | undefined—Receive the native blur event when focus leaves this control.
onChangeReact.ChangeEventHandler<HTMLDivElement, Element> | undefined—Receive the native change event; read the actual control value or checked state from its event target.
onKeyDownReact.KeyboardEventHandler<HTMLDivElement> | undefined—Receive keyboard events. Preserve built-in keyboard behavior unless deliberately implementing an accessible alternative.
onClickReact.MouseEventHandler<HTMLDivElement> | undefined—Receive activation events. The consumer owns the action performed and its result.
onSelectReact.ReactEventHandler<HTMLDivElement> | undefined—Handle the selection event defined by this part's source signature. DOM text-selection events differ from menu or command activation callbacks.
asChildboolean | undefined—Merge this part into one child instead of its default element. Preserve that child's semantics, ref support and accessibility attributes.
refReact.Ref<HTMLDivElement> | undefined—Allows getting a ref to the component instance. Once the component unmounts, React will set ref.current to null (or call the ref with null if you passed a callback ref).

MenubarCheckboxItem

One item within its parent composition. Keep parent context and the value, label or state required by the source API.

MenubarCheckboxItem props
PropTypeDefaultDescription
inputMode"search" | "text" | "none" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined—Hints at the type of data that might be entered by the user while editing the element or its contents
aria-describedbystring | undefined—Identifies the element (or elements) that describes the object.
aria-invalidboolean | "false" | "true" | "grammar" | "spelling" | undefined—Indicates the entered value does not conform to the format expected by the application.
aria-labelstring | undefined—Defines a string value that labels the current element.
aria-labelledbystring | undefined—Identifies the element (or elements) that labels the current element.
childrenReact.ReactNode—Represents all of the things React can render.
Inherited props (18)
MenubarCheckboxItem inherited props
PropTypeDefaultDescription
classNamestring | undefined—Additional classes for this part. Preserve contrast, visible focus and responsive content when adapting styles.
defaultCheckedboolean | undefined—Initial checked state for a control supporting uncontrolled selection. Inherited DOM typing does not give a layout wrapper checkbox behavior.
defaultValuestring | number | readonly string[] | undefined—Initial value for a control supporting uncontrolled state. Inherited DOM typing alone does not give a layout wrapper input behavior.
autoFocusboolean | undefined—Request automatic focus when the element mounts or the primitive opens, according to its source behavior. Choose initial focus deliberately in context.
idstring | undefined—Stable DOM identifier used by labels, descriptions or other explicit associations.
roleReact.AriaRole | undefined—Semantic role appropriate to the rendered element. Preserve required relationships and keyboard behavior.
onFocusReact.FocusEventHandler<HTMLDivElement> | undefined—Receive the native focus event. Preserve the component's existing keyboard and focus behavior.
onBlurReact.FocusEventHandler<HTMLDivElement> | undefined—Receive the native blur event when focus leaves this control.
onChangeReact.ChangeEventHandler<HTMLDivElement, Element> | undefined—Receive the native change event; read the actual control value or checked state from its event target.
onKeyDownReact.KeyboardEventHandler<HTMLDivElement> | undefined—Receive keyboard events. Preserve built-in keyboard behavior unless deliberately implementing an accessible alternative.
onClickReact.MouseEventHandler<HTMLDivElement> | undefined—Receive activation events. The consumer owns the action performed and its result.
onSelect((event: Event) => void) | undefined—Handle the selection event defined by this part's source signature. DOM text-selection events differ from menu or command activation callbacks.
asChildboolean | undefined—Merge this part into one child instead of its default element. Preserve that child's semantics, ref support and accessibility attributes.
disabledboolean | undefined—Make the supported control unavailable through its native or primitive disabled semantics. This does not disable arbitrary child links.
checked(boolean | "indeterminate") | undefined—Current checked state. Apply the requested value from onCheckedChange when the parent owns this state.
textValuestring | undefined—Plain text used for item matching or typeahead when its visible content is not a simple string.
onCheckedChange((checked: boolean) => void) | undefined—Receive the next checked state. Apply it to checked when the parent controls the component.
refReact.Ref<HTMLDivElement> | undefined—Allows getting a ref to the component instance. Once the component unmounts, React will set ref.current to null (or call the ref with null if you passed a callback ref).

MenubarContent

Content region within the root composition. Keep required providers, labels and related controls from the complete example.

MenubarContent props
PropTypeDefaultDescription
inputMode"search" | "text" | "none" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined—Hints at the type of data that might be entered by the user while editing the element or its contents
aria-describedbystring | undefined—Identifies the element (or elements) that describes the object.
aria-invalidboolean | "false" | "true" | "grammar" | "spelling" | undefined—Indicates the entered value does not conform to the format expected by the application.
aria-labelstring | undefined—Defines a string value that labels the current element.
aria-labelledbystring | undefined—Identifies the element (or elements) that labels the current element.
childrenReact.ReactNode—Represents all of the things React can render.
loopboolean | undefined—Whether keyboard navigation should loop around
onCloseAutoFocus((event: Event) => void) | undefined—Event handler called when auto-focusing on close. Can be prevented.
forceMounttrue | undefined—Used to force mounting when more control is needed. Useful when controlling animation with React animation libraries.
Inherited props (29)
MenubarContent inherited props
PropTypeDefaultDescription
classNamestring | undefined—Additional classes for this part. Preserve contrast, visible focus and responsive content when adapting styles.
defaultCheckedboolean | undefined—Initial checked state for a control supporting uncontrolled selection. Inherited DOM typing does not give a layout wrapper checkbox behavior.
defaultValuestring | number | readonly string[] | undefined—Initial value for a control supporting uncontrolled state. Inherited DOM typing alone does not give a layout wrapper input behavior.
autoFocusboolean | undefined—Request automatic focus when the element mounts or the primitive opens, according to its source behavior. Choose initial focus deliberately in context.
idstring | undefined—Stable DOM identifier used by labels, descriptions or other explicit associations.
roleReact.AriaRole | undefined—Semantic role appropriate to the rendered element. Preserve required relationships and keyboard behavior.
onFocusReact.FocusEventHandler<HTMLDivElement> | undefined—Receive the native focus event. Preserve the component's existing keyboard and focus behavior.
onBlurReact.FocusEventHandler<HTMLDivElement> | undefined—Receive the native blur event when focus leaves this control.
onChangeReact.ChangeEventHandler<HTMLDivElement, Element> | undefined—Receive the native change event; read the actual control value or checked state from its event target.
onKeyDownReact.KeyboardEventHandler<HTMLDivElement> | undefined—Receive keyboard events. Preserve built-in keyboard behavior unless deliberately implementing an accessible alternative.
onClickReact.MouseEventHandler<HTMLDivElement> | undefined—Receive activation events. The consumer owns the action performed and its result.
onSelectReact.ReactEventHandler<HTMLDivElement> | undefined—Handle the selection event defined by this part's source signature. DOM text-selection events differ from menu or command activation callbacks.
asChildboolean | undefined—Merge this part into one child instead of its default element. Preserve that child's semantics, ref support and accessibility attributes.
side"top" | "right" | "bottom" | "left" | undefined—Preferred side relative to the trigger. Collision handling can adjust the final placement where supported.
sideOffsetnumber | undefined6Spacing between the floating content and its trigger along the placement axis.
align"center" | "start" | "end" | undefined"start"Alignment of floating content relative to its trigger, using the supported source values.
alignOffsetnumber | undefined—Offset from the selected floating-content alignment.
arrowPaddingnumber | undefined—Minimum spacing between a floating arrow and the content's edges.
avoidCollisionsboolean | undefined—Allow floating content to adjust placement to avoid its collision boundary.
collisionBoundary(Element | null) | (Element | null)[] | undefined—Element or elements used as the boundary for floating-content collision checks.
collisionPaddingnumber | Partial<Record<"top" | "right" | "bottom" | "left", number>> | undefined—Space reserved between floating content and its collision boundary.
sticky("partial" | "always") | undefined—How floating content remains attached to its trigger while collision positioning is constrained.
hideWhenDetachedboolean | undefined—Hide floating content when its trigger becomes detached from the positioning boundary.
updatePositionStrategy("always" | "optimized") | undefined—Optimized or continuous updates to floating-content positioning, as supported by the primitive.
onEscapeKeyDown((event: KeyboardEvent) => void) | undefined—Handle Escape in the overlay. Cancelling default behavior changes dismissal responsibility.
onPointerDownOutside((event: CustomEvent<{ originalEvent: PointerEvent; }>) => void) | undefined—Handle pointer interaction outside the overlay using the primitive's event type.
onFocusOutside((event: CustomEvent<{ originalEvent: FocusEvent; }>) => void) | undefined—Handle focus moving outside the overlay; preserve the component's intended modality.
onInteractOutside((event: CustomEvent<{ originalEvent: PointerEvent; }> | CustomEvent<{ originalEvent: FocusEvent; }>) => void) | undefined—Handle supported outside interactions, including primitive-defined cancellation behavior.
refReact.Ref<HTMLDivElement> | undefined—Allows getting a ref to the component instance. Once the component unmounts, React will set ref.current to null (or call the ref with null if you passed a callback ref).

MenubarGroup

Group related parts while preserving the parent component's required composition.

MenubarGroup props
PropTypeDefaultDescription
inputMode"search" | "text" | "none" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined—Hints at the type of data that might be entered by the user while editing the element or its contents
aria-describedbystring | undefined—Identifies the element (or elements) that describes the object.
aria-invalidboolean | "false" | "true" | "grammar" | "spelling" | undefined—Indicates the entered value does not conform to the format expected by the application.
aria-labelstring | undefined—Defines a string value that labels the current element.
aria-labelledbystring | undefined—Identifies the element (or elements) that labels the current element.
childrenReact.ReactNode—Represents all of the things React can render.
Inherited props (14)
MenubarGroup inherited props
PropTypeDefaultDescription
classNamestring | undefined—Additional classes for this part. Preserve contrast, visible focus and responsive content when adapting styles.
defaultCheckedboolean | undefined—Initial checked state for a control supporting uncontrolled selection. Inherited DOM typing does not give a layout wrapper checkbox behavior.
defaultValuestring | number | readonly string[] | undefined—Initial value for a control supporting uncontrolled state. Inherited DOM typing alone does not give a layout wrapper input behavior.
autoFocusboolean | undefined—Request automatic focus when the element mounts or the primitive opens, according to its source behavior. Choose initial focus deliberately in context.
idstring | undefined—Stable DOM identifier used by labels, descriptions or other explicit associations.
roleReact.AriaRole | undefined—Semantic role appropriate to the rendered element. Preserve required relationships and keyboard behavior.
onFocusReact.FocusEventHandler<HTMLDivElement> | undefined—Receive the native focus event. Preserve the component's existing keyboard and focus behavior.
onBlurReact.FocusEventHandler<HTMLDivElement> | undefined—Receive the native blur event when focus leaves this control.
onChangeReact.ChangeEventHandler<HTMLDivElement, Element> | undefined—Receive the native change event; read the actual control value or checked state from its event target.
onKeyDownReact.KeyboardEventHandler<HTMLDivElement> | undefined—Receive keyboard events. Preserve built-in keyboard behavior unless deliberately implementing an accessible alternative.
onClickReact.MouseEventHandler<HTMLDivElement> | undefined—Receive activation events. The consumer owns the action performed and its result.
onSelectReact.ReactEventHandler<HTMLDivElement> | undefined—Handle the selection event defined by this part's source signature. DOM text-selection events differ from menu or command activation callbacks.
asChildboolean | undefined—Merge this part into one child instead of its default element. Preserve that child's semantics, ref support and accessibility attributes.
refReact.Ref<HTMLDivElement> | undefined—Allows getting a ref to the component instance. Once the component unmounts, React will set ref.current to null (or call the ref with null if you passed a callback ref).

MenubarItem

One item within its parent composition. Keep parent context and the value, label or state required by the source API.

MenubarItem props
PropTypeDefaultDescription
inputMode"search" | "text" | "none" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined—Hints at the type of data that might be entered by the user while editing the element or its contents
aria-describedbystring | undefined—Identifies the element (or elements) that describes the object.
aria-invalidboolean | "false" | "true" | "grammar" | "spelling" | undefined—Indicates the entered value does not conform to the format expected by the application.
aria-labelstring | undefined—Defines a string value that labels the current element.
aria-labelledbystring | undefined—Identifies the element (or elements) that labels the current element.
childrenReact.ReactNode—Represents all of the things React can render.
insetboolean | undefined—Indent the item's content to align it with neighboring items that include icons or selection indicators.
intent"neutral" | "error" | undefined—Semantic purpose, matching Button: neutral (default) or error for a destructive action. Preserve an explicit action label; styling does not implement confirmation.
variant"error" | "default" | undefined—Legacy alias of intent: "default" maps to intent="neutral" and "error" to intent="error".
Inherited props (16)
MenubarItem inherited props
PropTypeDefaultDescription
classNamestring | undefined—Additional classes for this part. Preserve contrast, visible focus and responsive content when adapting styles.
defaultCheckedboolean | undefined—Initial checked state for a control supporting uncontrolled selection. Inherited DOM typing does not give a layout wrapper checkbox behavior.
defaultValuestring | number | readonly string[] | undefined—Initial value for a control supporting uncontrolled state. Inherited DOM typing alone does not give a layout wrapper input behavior.
autoFocusboolean | undefined—Request automatic focus when the element mounts or the primitive opens, according to its source behavior. Choose initial focus deliberately in context.
idstring | undefined—Stable DOM identifier used by labels, descriptions or other explicit associations.
roleReact.AriaRole | undefined—Semantic role appropriate to the rendered element. Preserve required relationships and keyboard behavior.
onFocusReact.FocusEventHandler<HTMLDivElement> | undefined—Receive the native focus event. Preserve the component's existing keyboard and focus behavior.
onBlurReact.FocusEventHandler<HTMLDivElement> | undefined—Receive the native blur event when focus leaves this control.
onChangeReact.ChangeEventHandler<HTMLDivElement, Element> | undefined—Receive the native change event; read the actual control value or checked state from its event target.
onKeyDownReact.KeyboardEventHandler<HTMLDivElement> | undefined—Receive keyboard events. Preserve built-in keyboard behavior unless deliberately implementing an accessible alternative.
onClickReact.MouseEventHandler<HTMLDivElement> | undefined—Receive activation events. The consumer owns the action performed and its result.
onSelect((event: Event) => void) | undefined—Handle the selection event defined by this part's source signature. DOM text-selection events differ from menu or command activation callbacks.
asChildboolean | undefined—Merge this part into one child instead of its default element. Preserve that child's semantics, ref support and accessibility attributes.
disabledboolean | undefined—Make the supported control unavailable through its native or primitive disabled semantics. This does not disable arbitrary child links.
textValuestring | undefined—Plain text used for item matching or typeahead when its visible content is not a simple string.
refReact.Ref<HTMLDivElement> | undefined—Allows getting a ref to the component instance. Once the component unmounts, React will set ref.current to null (or call the ref with null if you passed a callback ref).

MenubarMenu

The MenubarMenu part of menubar. Use it with the complete source composition and preserve its required parent context.

MenubarMenu props
PropTypeDefaultDescription
childrenReact.ReactNode—Represents all of the things React can render.
Inherited props (2)
MenubarMenu inherited props
PropTypeDefaultDescription
valuestring | undefined—Current value in the shape defined by the source type. For controlled interactive inputs, apply updates from the change callback.
__scopeMenubarimport("@radix-ui/react-context").Scope—Internal Radix scope plumbing. It is not an application configuration option.

MenubarRadioGroup

Group related parts while preserving the parent component's required composition.

MenubarRadioGroup props
PropTypeDefaultDescription
inputMode"search" | "text" | "none" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined—Hints at the type of data that might be entered by the user while editing the element or its contents
aria-describedbystring | undefined—Identifies the element (or elements) that describes the object.
aria-invalidboolean | "false" | "true" | "grammar" | "spelling" | undefined—Indicates the entered value does not conform to the format expected by the application.
aria-labelstring | undefined—Defines a string value that labels the current element.
aria-labelledbystring | undefined—Identifies the element (or elements) that labels the current element.
childrenReact.ReactNode—Represents all of the things React can render.
Inherited props (16)
MenubarRadioGroup inherited props
PropTypeDefaultDescription
classNamestring | undefined—Additional classes for this part. Preserve contrast, visible focus and responsive content when adapting styles.
defaultCheckedboolean | undefined—Initial checked state for a control supporting uncontrolled selection. Inherited DOM typing does not give a layout wrapper checkbox behavior.
defaultValuestring | number | readonly string[] | undefined—Initial value for a control supporting uncontrolled state. Inherited DOM typing alone does not give a layout wrapper input behavior.
autoFocusboolean | undefined—Request automatic focus when the element mounts or the primitive opens, according to its source behavior. Choose initial focus deliberately in context.
idstring | undefined—Stable DOM identifier used by labels, descriptions or other explicit associations.
roleReact.AriaRole | undefined—Semantic role appropriate to the rendered element. Preserve required relationships and keyboard behavior.
onFocusReact.FocusEventHandler<HTMLDivElement> | undefined—Receive the native focus event. Preserve the component's existing keyboard and focus behavior.
onBlurReact.FocusEventHandler<HTMLDivElement> | undefined—Receive the native blur event when focus leaves this control.
onChangeReact.ChangeEventHandler<HTMLDivElement, Element> | undefined—Receive the native change event; read the actual control value or checked state from its event target.
onKeyDownReact.KeyboardEventHandler<HTMLDivElement> | undefined—Receive keyboard events. Preserve built-in keyboard behavior unless deliberately implementing an accessible alternative.
onClickReact.MouseEventHandler<HTMLDivElement> | undefined—Receive activation events. The consumer owns the action performed and its result.
onSelectReact.ReactEventHandler<HTMLDivElement> | undefined—Handle the selection event defined by this part's source signature. DOM text-selection events differ from menu or command activation callbacks.
asChildboolean | undefined—Merge this part into one child instead of its default element. Preserve that child's semantics, ref support and accessibility attributes.
valuestring | undefined—Current value in the shape defined by the source type. For controlled interactive inputs, apply updates from the change callback.
onValueChange((value: string) => void) | undefined—Receive the next value in the source-defined shape. A controlled parent must apply it to value.
refReact.Ref<HTMLDivElement> | undefined—Allows getting a ref to the component instance. Once the component unmounts, React will set ref.current to null (or call the ref with null if you passed a callback ref).

MenubarRadioItem

One item within its parent composition. Keep parent context and the value, label or state required by the source API.

MenubarRadioItem props
PropTypeDefaultDescription
inputMode"search" | "text" | "none" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined—Hints at the type of data that might be entered by the user while editing the element or its contents
aria-describedbystring | undefined—Identifies the element (or elements) that describes the object.
aria-invalidboolean | "false" | "true" | "grammar" | "spelling" | undefined—Indicates the entered value does not conform to the format expected by the application.
aria-labelstring | undefined—Defines a string value that labels the current element.
aria-labelledbystring | undefined—Identifies the element (or elements) that labels the current element.
childrenReact.ReactNode—Represents all of the things React can render.
Inherited props (17)
MenubarRadioItem inherited props
PropTypeDefaultDescription
classNamestring | undefined—Additional classes for this part. Preserve contrast, visible focus and responsive content when adapting styles.
defaultCheckedboolean | undefined—Initial checked state for a control supporting uncontrolled selection. Inherited DOM typing does not give a layout wrapper checkbox behavior.
defaultValuestring | number | readonly string[] | undefined—Initial value for a control supporting uncontrolled state. Inherited DOM typing alone does not give a layout wrapper input behavior.
autoFocusboolean | undefined—Request automatic focus when the element mounts or the primitive opens, according to its source behavior. Choose initial focus deliberately in context.
idstring | undefined—Stable DOM identifier used by labels, descriptions or other explicit associations.
roleReact.AriaRole | undefined—Semantic role appropriate to the rendered element. Preserve required relationships and keyboard behavior.
onFocusReact.FocusEventHandler<HTMLDivElement> | undefined—Receive the native focus event. Preserve the component's existing keyboard and focus behavior.
onBlurReact.FocusEventHandler<HTMLDivElement> | undefined—Receive the native blur event when focus leaves this control.
onChangeReact.ChangeEventHandler<HTMLDivElement, Element> | undefined—Receive the native change event; read the actual control value or checked state from its event target.
onKeyDownReact.KeyboardEventHandler<HTMLDivElement> | undefined—Receive keyboard events. Preserve built-in keyboard behavior unless deliberately implementing an accessible alternative.
onClickReact.MouseEventHandler<HTMLDivElement> | undefined—Receive activation events. The consumer owns the action performed and its result.
onSelect((event: Event) => void) | undefined—Handle the selection event defined by this part's source signature. DOM text-selection events differ from menu or command activation callbacks.
asChildboolean | undefined—Merge this part into one child instead of its default element. Preserve that child's semantics, ref support and accessibility attributes.
disabledboolean | undefined—Make the supported control unavailable through its native or primitive disabled semantics. This does not disable arbitrary child links.
value(required)string—Current value in the shape defined by the source type. For controlled interactive inputs, apply updates from the change callback.
textValuestring | undefined—Plain text used for item matching or typeahead when its visible content is not a simple string.
refReact.Ref<HTMLDivElement> | undefined—Allows getting a ref to the component instance. Once the component unmounts, React will set ref.current to null (or call the ref with null if you passed a callback ref).

MenubarSeparator

Visual or semantic separation between adjacent items. It is not an operable item.

MenubarSeparator props
PropTypeDefaultDescription
inputMode"search" | "text" | "none" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined—Hints at the type of data that might be entered by the user while editing the element or its contents
aria-describedbystring | undefined—Identifies the element (or elements) that describes the object.
aria-invalidboolean | "false" | "true" | "grammar" | "spelling" | undefined—Indicates the entered value does not conform to the format expected by the application.
aria-labelstring | undefined—Defines a string value that labels the current element.
aria-labelledbystring | undefined—Identifies the element (or elements) that labels the current element.
childrenReact.ReactNode—Represents all of the things React can render.
Inherited props (14)
MenubarSeparator inherited props
PropTypeDefaultDescription
classNamestring | undefined—Additional classes for this part. Preserve contrast, visible focus and responsive content when adapting styles.
defaultCheckedboolean | undefined—Initial checked state for a control supporting uncontrolled selection. Inherited DOM typing does not give a layout wrapper checkbox behavior.
defaultValuestring | number | readonly string[] | undefined—Initial value for a control supporting uncontrolled state. Inherited DOM typing alone does not give a layout wrapper input behavior.
autoFocusboolean | undefined—Request automatic focus when the element mounts or the primitive opens, according to its source behavior. Choose initial focus deliberately in context.
idstring | undefined—Stable DOM identifier used by labels, descriptions or other explicit associations.
roleReact.AriaRole | undefined—Semantic role appropriate to the rendered element. Preserve required relationships and keyboard behavior.
onFocusReact.FocusEventHandler<HTMLDivElement> | undefined—Receive the native focus event. Preserve the component's existing keyboard and focus behavior.
onBlurReact.FocusEventHandler<HTMLDivElement> | undefined—Receive the native blur event when focus leaves this control.
onChangeReact.ChangeEventHandler<HTMLDivElement, Element> | undefined—Receive the native change event; read the actual control value or checked state from its event target.
onKeyDownReact.KeyboardEventHandler<HTMLDivElement> | undefined—Receive keyboard events. Preserve built-in keyboard behavior unless deliberately implementing an accessible alternative.
onClickReact.MouseEventHandler<HTMLDivElement> | undefined—Receive activation events. The consumer owns the action performed and its result.
onSelectReact.ReactEventHandler<HTMLDivElement> | undefined—Handle the selection event defined by this part's source signature. DOM text-selection events differ from menu or command activation callbacks.
asChildboolean | undefined—Merge this part into one child instead of its default element. Preserve that child's semantics, ref support and accessibility attributes.
refReact.Ref<HTMLDivElement> | undefined—Allows getting a ref to the component instance. Once the component unmounts, React will set ref.current to null (or call the ref with null if you passed a callback ref).

MenubarShortcut

The MenubarShortcut part of menubar. Use it with the complete source composition and preserve its required parent context.

MenubarShortcut props
PropTypeDefaultDescription
inputMode"search" | "text" | "none" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined—Hints at the type of data that might be entered by the user while editing the element or its contents
aria-describedbystring | undefined—Identifies the element (or elements) that describes the object.
aria-invalidboolean | "false" | "true" | "grammar" | "spelling" | undefined—Indicates the entered value does not conform to the format expected by the application.
aria-labelstring | undefined—Defines a string value that labels the current element.
aria-labelledbystring | undefined—Identifies the element (or elements) that labels the current element.
childrenReact.ReactNode—Represents all of the things React can render.
Inherited props (13)
MenubarShortcut inherited props
PropTypeDefaultDescription
refReact.Ref<HTMLSpanElement> | undefined—Allows getting a ref to the component instance. Once the component unmounts, React will set ref.current to null (or call the ref with null if you passed a callback ref).
defaultCheckedboolean | undefined—Initial checked state for a control supporting uncontrolled selection. Inherited DOM typing does not give a layout wrapper checkbox behavior.
defaultValuestring | number | readonly string[] | undefined—Initial value for a control supporting uncontrolled state. Inherited DOM typing alone does not give a layout wrapper input behavior.
autoFocusboolean | undefined—Request automatic focus when the element mounts or the primitive opens, according to its source behavior. Choose initial focus deliberately in context.
classNamestring | undefined—Additional classes for this part. Preserve contrast, visible focus and responsive content when adapting styles.
idstring | undefined—Stable DOM identifier used by labels, descriptions or other explicit associations.
roleReact.AriaRole | undefined—Semantic role appropriate to the rendered element. Preserve required relationships and keyboard behavior.
onFocusReact.FocusEventHandler<HTMLSpanElement> | undefined—Receive the native focus event. Preserve the component's existing keyboard and focus behavior.
onBlurReact.FocusEventHandler<HTMLSpanElement> | undefined—Receive the native blur event when focus leaves this control.
onChangeReact.ChangeEventHandler<HTMLSpanElement, Element> | undefined—Receive the native change event; read the actual control value or checked state from its event target.
onKeyDownReact.KeyboardEventHandler<HTMLSpanElement> | undefined—Receive keyboard events. Preserve built-in keyboard behavior unless deliberately implementing an accessible alternative.
onClickReact.MouseEventHandler<HTMLSpanElement> | undefined—Receive activation events. The consumer owns the action performed and its result.
onSelectReact.ReactEventHandler<HTMLSpanElement> | undefined—Handle the selection event defined by this part's source signature. DOM text-selection events differ from menu or command activation callbacks.

MenubarSub

The MenubarSub part of menubar. Use it with the complete source composition and preserve its required parent context.

MenubarSub props
PropTypeDefaultDescription
childrenReact.ReactNode—Represents all of the things React can render.
Inherited props (3)
MenubarSub inherited props
PropTypeDefaultDescription
openboolean | undefined—Controlled visibility state. Pair with onOpenChange so requested state changes can be applied.
defaultOpenboolean | undefined—Initial uncontrolled visibility state. Later changes use the primitive's controls or controlled open API.
onOpenChange((open: boolean) => void) | undefined—Receive the requested open state. Apply it to open when controlled.

MenubarSubContent

Content region within the root composition. Keep required providers, labels and related controls from the complete example.

MenubarSubContent props
PropTypeDefaultDescription
inputMode"search" | "text" | "none" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined—Hints at the type of data that might be entered by the user while editing the element or its contents
aria-describedbystring | undefined—Identifies the element (or elements) that describes the object.
aria-invalidboolean | "false" | "true" | "grammar" | "spelling" | undefined—Indicates the entered value does not conform to the format expected by the application.
aria-labelstring | undefined—Defines a string value that labels the current element.
aria-labelledbystring | undefined—Identifies the element (or elements) that labels the current element.
childrenReact.ReactNode—Represents all of the things React can render.
loopboolean | undefined—Whether keyboard navigation should loop around
align("start" | "end") | undefined—Controls the direction the subcontent appears from its anchor menu item Default: start
forceMounttrue | undefined—Used to force mounting when more control is needed. Useful when controlling animation with React animation libraries.
Inherited props (27)
MenubarSubContent inherited props
PropTypeDefaultDescription
classNamestring | undefined—Additional classes for this part. Preserve contrast, visible focus and responsive content when adapting styles.
defaultCheckedboolean | undefined—Initial checked state for a control supporting uncontrolled selection. Inherited DOM typing does not give a layout wrapper checkbox behavior.
defaultValuestring | number | readonly string[] | undefined—Initial value for a control supporting uncontrolled state. Inherited DOM typing alone does not give a layout wrapper input behavior.
autoFocusboolean | undefined—Request automatic focus when the element mounts or the primitive opens, according to its source behavior. Choose initial focus deliberately in context.
idstring | undefined—Stable DOM identifier used by labels, descriptions or other explicit associations.
roleReact.AriaRole | undefined—Semantic role appropriate to the rendered element. Preserve required relationships and keyboard behavior.
onFocusReact.FocusEventHandler<HTMLDivElement> | undefined—Receive the native focus event. Preserve the component's existing keyboard and focus behavior.
onBlurReact.FocusEventHandler<HTMLDivElement> | undefined—Receive the native blur event when focus leaves this control.
onChangeReact.ChangeEventHandler<HTMLDivElement, Element> | undefined—Receive the native change event; read the actual control value or checked state from its event target.
onKeyDownReact.KeyboardEventHandler<HTMLDivElement> | undefined—Receive keyboard events. Preserve built-in keyboard behavior unless deliberately implementing an accessible alternative.
onClickReact.MouseEventHandler<HTMLDivElement> | undefined—Receive activation events. The consumer owns the action performed and its result.
onSelectReact.ReactEventHandler<HTMLDivElement> | undefined—Handle the selection event defined by this part's source signature. DOM text-selection events differ from menu or command activation callbacks.
asChildboolean | undefined—Merge this part into one child instead of its default element. Preserve that child's semantics, ref support and accessibility attributes.
sideOffsetnumber | undefined—Spacing between the floating content and its trigger along the placement axis.
alignOffsetnumber | undefined—Offset from the selected floating-content alignment.
arrowPaddingnumber | undefined—Minimum spacing between a floating arrow and the content's edges.
avoidCollisionsboolean | undefined—Allow floating content to adjust placement to avoid its collision boundary.
collisionBoundary(Element | null) | (Element | null)[] | undefined—Element or elements used as the boundary for floating-content collision checks.
collisionPaddingnumber | Partial<Record<"top" | "right" | "bottom" | "left", number>> | undefined—Space reserved between floating content and its collision boundary.
sticky("partial" | "always") | undefined—How floating content remains attached to its trigger while collision positioning is constrained.
hideWhenDetachedboolean | undefined—Hide floating content when its trigger becomes detached from the positioning boundary.
updatePositionStrategy("always" | "optimized") | undefined—Optimized or continuous updates to floating-content positioning, as supported by the primitive.
onEscapeKeyDown((event: KeyboardEvent) => void) | undefined—Handle Escape in the overlay. Cancelling default behavior changes dismissal responsibility.
onPointerDownOutside((event: CustomEvent<{ originalEvent: PointerEvent; }>) => void) | undefined—Handle pointer interaction outside the overlay using the primitive's event type.
onFocusOutside((event: CustomEvent<{ originalEvent: FocusEvent; }>) => void) | undefined—Handle focus moving outside the overlay; preserve the component's intended modality.
onInteractOutside((event: CustomEvent<{ originalEvent: PointerEvent; }> | CustomEvent<{ originalEvent: FocusEvent; }>) => void) | undefined—Handle supported outside interactions, including primitive-defined cancellation behavior.
refReact.Ref<HTMLDivElement> | undefined—Allows getting a ref to the component instance. Once the component unmounts, React will set ref.current to null (or call the ref with null if you passed a callback ref).

MenubarSubTrigger

Interactive control that opens or toggles the associated content. Preserve its accessible name and the required root context.

MenubarSubTrigger props
PropTypeDefaultDescription
inputMode"search" | "text" | "none" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined—Hints at the type of data that might be entered by the user while editing the element or its contents
aria-describedbystring | undefined—Identifies the element (or elements) that describes the object.
aria-invalidboolean | "false" | "true" | "grammar" | "spelling" | undefined—Indicates the entered value does not conform to the format expected by the application.
aria-labelstring | undefined—Defines a string value that labels the current element.
aria-labelledbystring | undefined—Identifies the element (or elements) that labels the current element.
childrenReact.ReactNode—Represents all of the things React can render.
insetboolean | undefined—Indent the item's content to align it with neighboring items that include icons or selection indicators.
Inherited props (16)
MenubarSubTrigger inherited props
PropTypeDefaultDescription
classNamestring | undefined—Additional classes for this part. Preserve contrast, visible focus and responsive content when adapting styles.
defaultCheckedboolean | undefined—Initial checked state for a control supporting uncontrolled selection. Inherited DOM typing does not give a layout wrapper checkbox behavior.
defaultValuestring | number | readonly string[] | undefined—Initial value for a control supporting uncontrolled state. Inherited DOM typing alone does not give a layout wrapper input behavior.
autoFocusboolean | undefined—Request automatic focus when the element mounts or the primitive opens, according to its source behavior. Choose initial focus deliberately in context.
idstring | undefined—Stable DOM identifier used by labels, descriptions or other explicit associations.
roleReact.AriaRole | undefined—Semantic role appropriate to the rendered element. Preserve required relationships and keyboard behavior.
onFocusReact.FocusEventHandler<HTMLDivElement> | undefined—Receive the native focus event. Preserve the component's existing keyboard and focus behavior.
onBlurReact.FocusEventHandler<HTMLDivElement> | undefined—Receive the native blur event when focus leaves this control.
onChangeReact.ChangeEventHandler<HTMLDivElement, Element> | undefined—Receive the native change event; read the actual control value or checked state from its event target.
onKeyDownReact.KeyboardEventHandler<HTMLDivElement> | undefined—Receive keyboard events. Preserve built-in keyboard behavior unless deliberately implementing an accessible alternative.
onClickReact.MouseEventHandler<HTMLDivElement> | undefined—Receive activation events. The consumer owns the action performed and its result.
onSelectReact.ReactEventHandler<HTMLDivElement> | undefined—Handle the selection event defined by this part's source signature. DOM text-selection events differ from menu or command activation callbacks.
asChildboolean | undefined—Merge this part into one child instead of its default element. Preserve that child's semantics, ref support and accessibility attributes.
disabledboolean | undefined—Make the supported control unavailable through its native or primitive disabled semantics. This does not disable arbitrary child links.
textValuestring | undefined—Plain text used for item matching or typeahead when its visible content is not a simple string.
refReact.Ref<HTMLDivElement> | undefined—Allows getting a ref to the component instance. Once the component unmounts, React will set ref.current to null (or call the ref with null if you passed a callback ref).

MenubarTrigger

Interactive control that opens or toggles the associated content. Preserve its accessible name and the required root context.

MenubarTrigger props
PropTypeDefaultDescription
inputMode"search" | "text" | "none" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined—Hints at the type of data that might be entered by the user while editing the element or its contents
aria-describedbystring | undefined—Identifies the element (or elements) that describes the object.
aria-invalidboolean | "false" | "true" | "grammar" | "spelling" | undefined—Indicates the entered value does not conform to the format expected by the application.
aria-labelstring | undefined—Defines a string value that labels the current element.
aria-labelledbystring | undefined—Identifies the element (or elements) that labels the current element.
childrenReact.ReactNode—Represents all of the things React can render.
Inherited props (19)
MenubarTrigger inherited props
PropTypeDefaultDescription
formstring | undefined—ID of the form associated with this control, including when it is rendered outside that form element.
classNamestring | undefined—Additional classes for this part. Preserve contrast, visible focus and responsive content when adapting styles.
defaultCheckedboolean | undefined—Initial checked state for a control supporting uncontrolled selection. Inherited DOM typing does not give a layout wrapper checkbox behavior.
defaultValuestring | number | readonly string[] | undefined—Initial value for a control supporting uncontrolled state. Inherited DOM typing alone does not give a layout wrapper input behavior.
autoFocusboolean | undefined—Request automatic focus when the element mounts or the primitive opens, according to its source behavior. Choose initial focus deliberately in context.
idstring | undefined—Stable DOM identifier used by labels, descriptions or other explicit associations.
roleReact.AriaRole | undefined—Semantic role appropriate to the rendered element. Preserve required relationships and keyboard behavior.
onFocusReact.FocusEventHandler<HTMLButtonElement> | undefined—Receive the native focus event. Preserve the component's existing keyboard and focus behavior.
onBlurReact.FocusEventHandler<HTMLButtonElement> | undefined—Receive the native blur event when focus leaves this control.
onChangeReact.ChangeEventHandler<HTMLButtonElement, Element> | undefined—Receive the native change event; read the actual control value or checked state from its event target.
onKeyDownReact.KeyboardEventHandler<HTMLButtonElement> | undefined—Receive keyboard events. Preserve built-in keyboard behavior unless deliberately implementing an accessible alternative.
onClickReact.MouseEventHandler<HTMLButtonElement> | undefined—Receive activation events. The consumer owns the action performed and its result.
onSelectReact.ReactEventHandler<HTMLButtonElement> | undefined—Handle the selection event defined by this part's source signature. DOM text-selection events differ from menu or command activation callbacks.
asChildboolean | undefined—Merge this part into one child instead of its default element. Preserve that child's semantics, ref support and accessibility attributes.
disabledboolean | undefined—Make the supported control unavailable through its native or primitive disabled semantics. This does not disable arbitrary child links.
namestring | undefined—Name used by the control's form submission or primitive form integration.
type"button" | "submit" | "reset" | undefined—Native element or primitive mode defined by the source union. Choose a supported value; its meaning depends on the component.
valuestring | number | readonly string[] | undefined—Current value in the shape defined by the source type. For controlled interactive inputs, apply updates from the change callback.
refReact.Ref<HTMLButtonElement> | undefined—Allows getting a ref to the component instance. Once the component unmounts, React will set ref.current to null (or call the ref with null if you passed a callback ref).

Accessibility & usage

From registry/ui/menubar.meta.json (authored guidance; human review may still be pending). Behavior is checked by Storybook tests, not certified here.

When to use

  • An editor or tool with many commands that users expect in familiar top-level groups, and that keyboard users browse with arrow keys across menus.
  • Commands that change a document or workspace, including checkable settings (MenubarCheckboxItem) and exclusive choices (MenubarRadioGroup with MenubarRadioItem).
  • Deep command sets where a second level helps: MenubarSub, MenubarSubTrigger and MenubarSubContent open to the side.
  • Showing the keyboard shortcut of a command next to it with MenubarShortcut, when the application actually binds that shortcut.

When not to use

  • Website or app navigation between pages; menu roles tell assistive technology these are commands, not links.
  • One trigger with a handful of actions for an object, such as a row or a card; a single dropdown menu is lighter.
  • Picking a form value; the selection is not part of a form and has no label or validation.
  • Primary actions users must discover: commands hidden in menus are found less often than visible buttons.

Anatomy

Menubar
Root with role menubar. Holds the row of triggers and manages roving focus between them; accepts Radix props such as loop, dir, value and onValueChange.
MenubarMenu
One top-level menu: pairs a trigger with its content. Has no DOM of its own.
MenubarTrigger
Top-level item (role menuitem with aria-haspopup) that opens its content. Its text is the menu name.
MenubarContent
Portaled popup with role menu. Defaults to align="start" and sideOffset 6; collision handling keeps it on screen.
MenubarItem
A command. Supports disabled, inset (aligns with checkable items) and intent="neutral" | "error" (variant is a legacy alias).
MenubarCheckboxItem
role menuitemcheckbox; consumer-owned checked and onCheckedChange. Renders the check indicator.
MenubarRadioGroup and MenubarRadioItem
Exclusive choice: role menuitemradio items inside a group whose value and onValueChange the consumer owns.
MenubarGroup and MenubarSeparator
Group related items; the separator is a non-focusable divider between groups.
MenubarSub, MenubarSubTrigger and MenubarSubContent
Nested menu. The sub trigger shows a chevron (mirrored in RTL) and supports inset.
MenubarShortcut
Plain text span aligned to the end of an item for a shortcut hint. Displays keys only; it does not register them.

Keyboard & interaction

  • Follows the WAI-ARIA APG menubar pattern through Radix: Tab reaches the menubar once, then Arrow Left/Right move between top-level triggers (wrapping by default).
  • Enter, Space or Arrow Down on a trigger opens its menu and focuses the first item; Escape closes it and returns focus to the trigger.
  • Inside a menu, Arrow Up/Down move between items, Home/End jump to the ends, typing a letter jumps to a matching item, and disabled items are skipped.
  • Arrow Right opens a submenu from its sub trigger and Arrow Left closes it; on a plain item, Arrow Left/Right move to the neighbouring top-level menu. Directions flip with dir="rtl".
  • While one menu is open, hovering another trigger switches menus, so users can scan the bar with the pointer.
  • Selecting an item runs onSelect and closes the menu; checkbox and radio items also close unless the consumer calls event.preventDefault() in onSelect to keep the menu open.
  • Only one menu of a menubar is open at a time; content is portaled and animations stop under prefers-reduced-motion.

Responsive behavior

  • A menubar is a desktop pattern: on narrow or touch-first layouts, expose the same commands through a single dropdown menu, a sheet or a command palette instead of a row that overflows.
  • Keep the top-level row short (about three to seven menus) so it fits at 320px CSS width without horizontal page scroll (WCAG 1.4.10); wrap or move it into an overflow menu rather than clipping.
  • Menu content repositions to stay inside the viewport; long item labels should wrap or be shortened rather than widen the menu past the screen.
  • Triggers and items need at least 24x24 CSS pixels of target (WCAG 2.5.8); keep the default padding or larger on touch devices.

Content guidelines

  • Name top-level menus with one familiar noun: File, Edit, View, Insert, Help. Users scan by these words.
  • Start items with a verb that names the result ('Duplicate', 'Export as PDF'); end an item with an ellipsis ('Rename...') when it opens a dialog that needs more input.
  • Write shortcut hints in the platform's notation and keep them consistent everywhere they appear.
  • Name destructive items with the object ('Delete project...') and separate them from safe commands with a separator.
  • Checkbox items read as a setting that is on or off ('Line numbers'); radio items share one question answered by the group ('Small text', 'Medium text').

Alternatives

  • Dropdown menu — One trigger with a short list of actions for a single object or area.
  • Context menu — Secondary actions on right-click or long-press of an item, mirrored by a visible control.
  • Command — A searchable list when there are too many commands to browse, or as the narrow-screen replacement for a menubar.
  • Navigation menu — Site or product navigation made of real links.

Resources