Skip to content

Search documentation

Search guides, examples, and component APIs.

Quick links
↑↓ NavigateEnter OpenEsc Close
Get started

Documentation navigation

Components / Navigation

Menubar

A persistent desktop-style command bar with managed top-level and nested menu focus.

Last changed in version 0.14.2: Improve keyboard navigation, action feedback, and selected colors across Vue components.

Interactive showcase

Install

Run in your project
bunx --bun @getweini/cli@latest add menubar

Start with this example

Import the files copied by the install command, then place the component in your Vue template. The text and values in the example belong to your app; change them to fit your task.

Vue
<script setup lang="ts">
import Menubar from './components/ui/menubar/Menubar.vue'
import MenubarContent from './components/ui/menubar/MenubarContent.vue'
import MenubarItem from './components/ui/menubar/MenubarItem.vue'
import MenubarMenu from './components/ui/menubar/MenubarMenu.vue'
import MenubarTrigger from './components/ui/menubar/MenubarTrigger.vue'

function run(action: { id: string }) {
  console.log(action.id)
}
</script>

<template>
  <Menubar>
    <MenubarMenu value="file" @select="run">
      <MenubarTrigger>File</MenubarTrigger>
      <MenubarContent aria-label="File commands">
        <MenubarItem id="new" label="New document">New document</MenubarItem>
        <MenubarItem id="open" label="Open document">Open document</MenubarItem>
      </MenubarContent>
    </MenubarMenu>
    <MenubarMenu value="edit" @select="run">
      <MenubarTrigger>Edit</MenubarTrigger>
      <MenubarContent aria-label="Edit commands">
        <MenubarItem id="undo" label="Undo">Undo</MenubarItem>
      </MenubarContent>
    </MenubarMenu>
  </Menubar>
</template>

The arrow marks a trigger with menu content, and a flush triangle on the open menu points back to it across the standard 12px gap. The open menu stays visibly active. Click or use Left and Right to switch top-level menus; hover alone does not switch them. Add #prefix and #suffix content to menu items. Typeahead finds items, and Escape closes the menu.

When to use it

Editor commands

Expose File, Edit, and View commands in a persistent desktop-style bar.

Document actions

Group document operations without filling the main toolbar.

More examples

File and Edit menus

Handle selected item IDs in application code.

File and Edit menus
<script setup lang="ts">
import Menubar from './components/ui/menubar/Menubar.vue'
import MenubarContent from './components/ui/menubar/MenubarContent.vue'
import MenubarItem from './components/ui/menubar/MenubarItem.vue'
import MenubarMenu from './components/ui/menubar/MenubarMenu.vue'
import MenubarTrigger from './components/ui/menubar/MenubarTrigger.vue'

function run(action: { id: string }) {
  console.log(action.id)
}
</script>

<template>
  <Menubar>
    <MenubarMenu value="file" @select="run">
      <MenubarTrigger>File</MenubarTrigger>
      <MenubarContent aria-label="File commands">
        <MenubarItem id="new" label="New document">New document</MenubarItem>
        <MenubarItem id="open" label="Open document">Open document</MenubarItem>
      </MenubarContent>
    </MenubarMenu>
    <MenubarMenu value="edit" @select="run">
      <MenubarTrigger>Edit</MenubarTrigger>
      <MenubarContent aria-label="Edit commands">
        <MenubarItem id="undo" label="Undo">Undo</MenubarItem>
      </MenubarContent>
    </MenubarMenu>
  </Menubar>
</template>

View options

A single menu also works when a compact application needs one command group.

View options
<script setup lang="ts">
import Menubar from './components/ui/menubar/Menubar.vue'
import MenubarContent from './components/ui/menubar/MenubarContent.vue'
import MenubarItem from './components/ui/menubar/MenubarItem.vue'
import MenubarMenu from './components/ui/menubar/MenubarMenu.vue'
import MenubarTrigger from './components/ui/menubar/MenubarTrigger.vue'

function select(action: { id: string }) {
  console.log(action.id)
}
</script>

<template>
  <Menubar>
    <MenubarMenu value="view" @select="select">
      <MenubarTrigger>View</MenubarTrigger>
      <MenubarContent aria-label="View commands">
        <MenubarItem id="zoom-in" label="Zoom in">Zoom in</MenubarItem>
        <MenubarItem id="zoom-out" label="Zoom out">Zoom out</MenubarItem>
      </MenubarContent>
    </MenubarMenu>
  </Menubar>
</template>

Complete API

Every public prop, model, event, slot, and exposed member of the installed Vue parts is listed below. “Not set” means you can leave that value out; “Required” means you must provide it. Native HTML attributes also work where the component uses a native element.

Menubar

Complete API for Menubar
NameType or signatureDefaultWhat it does
modelValuemodelstring | undefinedNot setCurrent value. Use v-model to keep it in sync with your page.
defaultValuepropstring | undefinedNot setStarting value when the parent does not control the value.
dirprop"ltr" | "rtl" | undefined"ltr"Set the text direction used for keyboard and layout behavior.
update:modelValueevent[value: string | undefined]—Requests a new model value from the parent.
valueChangeevent[value: string | undefined]—Emitted after this value or state changes.
defaultslot{}OptionalContent shown inside Menubar.

MenubarCheckboxItem

Complete API for MenubarCheckboxItem
NameType or signatureDefaultWhat it does
idpropstringRequiredGive the control an ID so a label or description can refer to it.
labelpropstringRequiredVisible or accessible name for this item.
checkedpropboolean | undefinedNot setCurrent checked state of this choice.
disabledpropboolean | undefinedNot setPrevent interaction and show the disabled state.
destructivepropboolean | undefinedNot setShow that an action has a potentially destructive result.
shortcutpropstring | undefinedNot setKeyboard shortcut displayed beside this action.
defaultslot{}OptionalContent shown inside MenubarCheckboxItem.
prefixslot{}OptionalContent shown before the main label or value.
suffixslot{}OptionalContent shown after the main label or value.

MenubarContent

Complete API for MenubarContent
NameType or signatureDefaultWhat it does
defaultslot{}OptionalContent shown inside MenubarContent.

MenubarGroup

Complete API for MenubarGroup
NameType or signatureDefaultWhat it does
defaultslot{}OptionalContent shown inside MenubarGroup.

MenubarItem

Complete API for MenubarItem
NameType or signatureDefaultWhat it does
defaultslot{}OptionalContent shown inside MenubarItem.
prefixslot{}OptionalContent shown before the main label or value.
suffixslot{}OptionalContent shown after the main label or value.

MenubarLabel

Complete API for MenubarLabel
NameType or signatureDefaultWhat it does
defaultslot{}OptionalContent shown inside MenubarLabel.

MenubarMenu

Complete API for MenubarMenu
NameType or signatureDefaultWhat it does
valuepropstringRequiredValue represented by this control or option.
disabledpropboolean | undefinedNot setPrevent interaction and show the disabled state.
selectevent[action: DropdownMenuAction]—Emitted when the user selects an item.
defaultslot{}OptionalContent shown inside MenubarMenu.

MenubarRadioGroup

Complete API for MenubarRadioGroup
NameType or signatureDefaultWhat it does
defaultslot{}OptionalContent shown inside MenubarRadioGroup.

MenubarRadioItem

Complete API for MenubarRadioItem
NameType or signatureDefaultWhat it does
idpropstringRequiredGive the control an ID so a label or description can refer to it.
valuepropstringRequiredValue represented by this control or option.
labelpropstringRequiredVisible or accessible name for this item.
disabledpropboolean | undefinedNot setPrevent interaction and show the disabled state.
shortcutpropstring | undefinedNot setKeyboard shortcut displayed beside this action.
defaultslot{}OptionalContent shown inside MenubarRadioItem.
prefixslot{}OptionalContent shown before the main label or value.
suffixslot{}OptionalContent shown after the main label or value.

MenubarSeparator

Complete API for MenubarSeparator
NameType or signatureDefaultWhat it does

MenubarSub

Complete API for MenubarSub
NameType or signatureDefaultWhat it does
defaultslot{}OptionalContent shown inside MenubarSub.

MenubarSubContent

Complete API for MenubarSubContent
NameType or signatureDefaultWhat it does
defaultslot{}OptionalContent shown inside MenubarSubContent.

MenubarSubTrigger

Complete API for MenubarSubTrigger
NameType or signatureDefaultWhat it does
defaultslot{}OptionalContent shown inside MenubarSubTrigger.
prefixslot{}OptionalContent shown before the main label or value.
suffixslot{}OptionalContent shown after the main label or value.

MenubarTrigger

Complete API for MenubarTrigger
NameType or signatureDefaultWhat it does
defaultslot{}OptionalContent shown inside MenubarTrigger.
Public type definitions
Public types
// packages/frameworks/vue/components/menubar/types.ts
export interface MenubarProps {
  modelValue?: string
  defaultValue?: string
  dir?: 'ltr' | 'rtl'
}

export interface MenubarMenuProps {
  value: string
  disabled?: boolean
}

Implementation notes

  • Triggers expose data-state="open" or data-state="closed" for state styling.
  • Menu items emit intent; run commands and enforce permissions in the application.
  • Use stable IDs and labels so keyboard typeahead and selection remain predictable.

Accessibility and localization

  • Top-level menus use managed keyboard focus; name each content region for its command group.

Source contract and editing guidance