Getting startedComponentsDesign tokensThemingTheme synthesizerFrameworksAccessibilityUtilitiesServer renderingBrowser supportContributingChangelogApp ShellAspect GridAuth ShellCenterContainerDashboard GridFloat BarInsetMasonryPage HeaderPage LayoutResizableResponsive SwitcherSectionSettings LayoutSplit PaneStatus BarStickyToolbarAnchor NavBottom NavBreadcrumbBreadcrumb MenuCommand BarDrawerFooterLinkMenubarNavigation MenuPage IndicatorPaginationRailScroll IndicatorScroll SpyScroll To TopSidebarSkip LinkStepper NavTabsTop BarTree ViewAccordionAspect RatioAvatarAvatar GroupCardCarouselCollapsibleColor SwatchCTA BannerDividerEmpty StateFeature CardIconImageImage CompareImage HotspotsInfinite ScrollLightboxMarqueeQR CodeScroll AreaSkeletonSpinnerStackVideoVirtual ListActivity HeatmapAnimated NumberBadgeBar ListChartClockComparisonCountdown TimerData GridDescription ListDiffGaugeJSON TreeKanbanLevel MeterListMeterSparklineStatStepperTagTimelineUptimeValue CardWaveformBlockquoteCode BlockCode GroupGradient TextHighlightKbdKeyboard MapMarkdownNumber FormatProseTerminalTextTime AgoTruncateTypewriterButtonButton GroupCalendarCheckboxChipColor PickerComboboxCopy ButtonDate PickerDate Range PickerField ListFieldsetFile UploadFormHotkeyIcon ButtonImage CropperInline EditInputInput GroupKnobLabelMasked InputMulti SelectNumber InputPassword InputPin InputRadio GroupRange SliderRatingSearchSegmented ControlSelectSignature PadSliderSortable ListSwitch GroupTag InputTextareaTheme ToggleTime PickerToggleTransfer ListTree SelectAlertAnnouncementBannerCommand PaletteConfirmConnection StatusContext MenuConversationDialogDropdown MenuHover CardLoading OverlayNotification PanelPopoverProgressSheetToastTooltip
ARC UIARC Radiant Components
v4.9DocsComponentsTokensSynthesizer
Getting startedFrameworksServer renderingDesign tokensThemingTheme synthesizerTypographyUtilitiesAll componentsAccessibilityBrowser supportChangelogContributingStatsApp ShellAspect GridAuth ShellCenterContainerDashboard GridFloat BarInsetMasonryPage HeaderPage LayoutResizableResponsive SwitcherSectionSettings LayoutSplit PaneStatus BarStickyToolbarAnchor NavBottom NavBreadcrumbBreadcrumb MenuCommand BarDrawerFooterLinkMenubarNavigation MenuPage IndicatorPaginationRailScroll IndicatorScroll SpyScroll To TopSidebarSkip LinkStepper NavTabsTop BarTree ViewAccordionAspect RatioAvatarAvatar GroupCardCarouselCollapsibleColor SwatchCTA BannerDividerEmpty StateFeature CardIconImageImage CompareImage HotspotsInfinite ScrollLightboxMarqueeQR CodeScroll AreaSkeletonSpinnerStackVideoVirtual ListActivity HeatmapAnimated NumberBadgeBar ListChartClockComparisonCountdown TimerData GridDescription ListDiffGaugeJSON TreeKanbanLevel MeterListMeterSparklineStatStepperTagTimelineUptimeValue CardWaveformBlockquoteCode BlockCode GroupGradient TextHighlightKbdKeyboard MapMarkdownNumber FormatProseTerminalTextTime AgoTruncateTypewriterButtonButton GroupCalendarCheckboxChipColor PickerComboboxCopy ButtonDate PickerDate Range PickerField ListFieldsetFile UploadFormHotkeyIcon ButtonImage CropperInline EditInputInput GroupKnobLabelMasked InputMulti SelectNumber InputPassword InputPin InputRadio GroupRange SliderRatingSearchSegmented ControlSelectSignature PadSliderSortable ListSwitch GroupTag InputTextareaTheme ToggleTime PickerToggleTransfer ListTree SelectAlertAnnouncementBannerCommand PaletteConfirmConnection StatusContext MenuConversationDialogDropdown MenuHover CardLoading OverlayNotification PanelPopoverProgressSheetToastTooltip

Menubar

Desktop-application menu bar (File, Edit, View) with submenus, shortcut hints and WAI-ARIA menubar keyboard navigation.

ComponentsMenubar
navigationinteractivebeta
<arc-menubar>

Overview

Menubar is the row of menus from desktop applications: File, Edit and View, each opening a dropdown of commands. One `items` array describes it all, set as a property from JavaScript or as a JSON attribute when the menu is static. The component renders the triggers, menus, submenus, dividers and right-aligned shortcut hints. An entry with its own `items` array becomes a submenu, marked with a caret. Submenus go one level deep. They open to the right of their parent and flip to the left when they would overflow the viewport. `{ divider: true }` renders a separator line, keyboard navigation skips `disabled` entries, and `shortcut` strings show in muted monospace. Shortcuts are display only: the component doesn't bind any keys. Interaction follows the WAI-ARIA menubar pattern. The bar is a single tab stop with roving focus: ArrowLeft and ArrowRight move across top-level items, ArrowDown or Enter opens a menu, and ArrowUp opens it on the last item. Inside a menu, the arrows move and wrap past dividers and disabled items, ArrowRight enters a submenu, ArrowLeft steps back out (or over to the previous top-level menu), typing a letter jumps to the next item that starts with it, and Escape closes one level at a time and returns focus to the trigger. With a pointer, clicking a trigger toggles its menu, hovering another trigger switches menus once one is open, and hovering a submenu parent opens it after a short delay. Activating a leaf fires `arc-select` with the label path from root to leaf.

Guidelines

Do

  • Group related commands with `{ divider: true }` entries
  • Make `shortcut` strings match your real key bindings. You register the bindings yourself
  • Keep top-level labels to one word (File, Edit, View)
  • Route commands by the label path in `arc-select`

Don't

  • Don't use it for site navigation. Use Navigation Menu or Top Bar. A menubar is for application commands
  • Don't put destructive actions right next to common ones without a divider between them
  • Don't use more than 7 or 8 top-level menus. Move rare commands into a submenu

Features

  • Roles are `menubar`, `menu` and `menuitem`, with a roving tabindex
  • Home and End jump to the first and last item, and Space activates an item like Enter
  • Typing a letter also works on the bar itself when no menu is open
  • Submenus open after about 150ms of hover
  • `arc-select` puts the path in `detail.path`, such as `["File", "Export", "PNG"]`

Preview

selected: none

Usage

This component needs JavaScript. Use the Web Component or a framework wrapper.

<arc-menubar id="app-menubar"></arc-menubar>

<script>
  const menubar = document.getElementById('app-menubar');
  menubar.items = [
    { label: 'File', items: [
      { label: 'New File', shortcut: '⌘N' },
      { label: 'Open…', shortcut: '⌘O' },
      { divider: true },
      { label: 'Export', items: [
        { label: 'PNG' },
        { label: 'SVG' }
      ] }
    ] },
    { label: 'Edit', items: [
      { label: 'Undo', shortcut: '⌘Z' },
      { label: 'Redo', shortcut: '⇧⌘Z', disabled: true }
    ] }
  ];

  menubar.addEventListener('arc-select', (e) => {
    console.log('command:', e.detail.path); // e.g. ['File', 'Export', 'PNG']
  });
</script>

API

itemsArray<{label:string,disabled?:boolean,items:Array<{label?:string,shortcut?:string,disabled?:boolean,divider?:boolean,items?:Array<{label:string,shortcut?:string,disabled?:boolean}>}>}>[]
The menu structure. Entries with an items array become submenus (one further nesting level supported); { divider: true } renders a separator. Set as a property, or as a JSON attribute for a menu structure that is static.

Events

arc-select
Fired when a leaf menu item is activated. detail.path is the array of labels from the top-level menu to the selected leaf, e.g. ["File", "Export", "PNG"].

See also