Skip to content

Menubar

Arrange related action menus in a horizontal bar.

Demos

Size

Usage

vue
<script setup lang="ts">
import { Accordion } from '~/components/ui/accordion'

const items = [
  { value: 'source', label: 'Do I own the source?', content: 'Yes. Copy and adapt the files.' },
]
</script>

<template>
  <Accordion :items="items" />
</template>

Installation

Complete the shared installation. Copy Menubar.vue and index.ts into app/components/ui/menubar/.

API

Variants and defaults

PropValuesDefault
sizexs, sm, md, lg, xlsm

Props

PropTypeDefaultDescription
itemsMenubarItem[]requiredTop-level menu items. Items with children open panels.
loopbooleantrueLeft/right focus wraps.
dir"ltr" | "rtl""ltr"Reverses horizontal arrow behavior for RTL.
teleportstring | false"body"Popup target. Set false for inline panels; ancestor overflow and stacking then apply.
disabledbooleanfalseDisables the menubar.
closeOnSelectbooleantrueCloses after normal item selection.
radioValuesRecord<string, string>—State for radio groups inside panels.
ariaLabelstring—Accessible label.
ariaLabelledbystring—Accessible label id.
uiMenubarUi—Classes for root, triggers, content, and menu parts.

Slots

SlotPropsDescription
triggeritem, isOpenTop-level trigger content.
[item.slot]Depends on item typePer-item panel renderer.
checkbox-itemitem, checkedShared checkbox item renderer.
radio-itemitem, checkedShared radio item renderer.
labelitemShared label renderer.

Events

EventPayloadDescription
open-change(value: string | null, details)Fired before active menu changes.
select(item, details)Fired when an item is selected.
check-change(item, checked, details)Fired when checkbox item changes.
radio-change(group, value, details)Fired when radio item changes.
update:radioValues(values)v-model event for radio state.

Keyboard

Submenus use Menu's viewport collision positioning. Horizontal arrows follow dir even when a submenu flips visually. Opening a submenu does not switch the top-level menu.

Menubar panels join the shared floating-layer stack and teleport to body by default so ancestor clipping and stacking contexts do not trap them. Set --akaza-z-layer-base (default 1200) globally to change its base or set --akaza-z-menubar on the popup to override its z-index. Use ui.content for popup styles; descendant selectors from the menubar root do not cross Teleport. Nested panels share Menu's styling hooks.

KeyBehavior
ArrowRight / ArrowLeftMove between top-level triggers.
ArrowDownOpen active menu and focus first panel item.
ArrowUpOpen active menu and focus last panel item.
Enter / SpaceOpen a menu or activate a top-level command without children.
ArrowUp / ArrowDownMove within an open panel.
Home / EndFocus first/last enabled top-level item.
Character keysTypeahead across top-level items.
EscapeClose the open panel and return focus to its trigger.