Seleção e menus

VMenuBar

Componente9 exemplos8 props

Componente VueUI Nova para **menu bar**, seguindo tokens semânticos e Light Mode como referência principal.

Importação
<script setup lang="ts">
import { VMenuBar } from 'vueui-nova-kit'
</script>

Uso

Exemplo
<script setup lang="ts">

</script>

<template>
  
</template>

Playground

Os controles abaixo são gerados a partir das props declaradas em VMenuBar.types.ts; o código acompanha cada mudança.

Exemplos

Variantes, tamanhos e estados, extraídos das stories da biblioteca.

Default

Variação Padrão. Estado padrão do componente; use a aba Controls para experimentar as props ao vivo.

Ver código
vue
<script setup lang="ts">
import { VMenuBar } from 'vueui-nova-kit'

const items = [
  {
    value: 'file',
    label: 'File',
    children: [
      { value: 'new', label: 'New', shortcut: '⌘N' },
      { value: 'open', label: 'Open…', shortcut: '⌘O' },
      { value: 'divider-1', label: '', divider: true },
      { value: 'save', label: 'Save', shortcut: '⌘S' },
      { value: 'save-as', label: 'Save As…', shortcut: '⇧⌘S' },
      { value: 'divider-2', label: '', divider: true },
      { value: 'quit', label: 'Quit', shortcut: '⌘Q' },
    ],
  },
  {
    value: 'edit',
    label: 'Edit',
    children: [
      { value: 'undo', label: 'Undo', shortcut: '⌘Z' },
      { value: 'redo', label: 'Redo', shortcut: '⇧⌘Z' },
      { value: 'divider-edit-1', label: '', divider: true },
      { value: 'cut', label: 'Cut', shortcut: '⌘X' },
      { value: 'copy', label: 'Copy', shortcut: '⌘C' },
      { value: 'paste', label: 'Paste', shortcut: '⌘V' },
    ],
  },
  {
    value: 'view',
    label: 'View',
    children: [
      { value: 'zoom-in', label: 'Zoom In', shortcut: '⌘+' },
      { value: 'zoom-out', label: 'Zoom Out', shortcut: '⌘-' },
      { value: 'divider-view-1', label: '', divider: true },
      {
        value: 'fullscreen',
        label: 'Enter Full Screen',
        shortcut: '⌃⌘F',
      },
    ],
  },
  {
    value: 'help',
    label: 'Help',
    children: [
      { value: 'docs', label: 'Documentation' },
      { value: 'shortcuts', label: 'Keyboard Shortcuts' },
      { value: 'divider-help-1', label: '', divider: true },
      { value: 'about', label: 'About' },
    ],
  },
]
</script>

<template>
  <VMenuBar :items="items" aria-label="Application menu" />
</template>

With Shortcuts

Variação Com Shortcuts.

Ver código
vue
<script setup lang="ts">
import { VMenuBar } from 'vueui-nova-kit'

const items = [
  {
    value: 'file',
    label: 'File',
    children: [
      { value: 'new', label: 'New', shortcut: '⌘N' },
      { value: 'open', label: 'Open…', shortcut: '⌘O' },
      { value: 'divider-1', label: '', divider: true },
      { value: 'save', label: 'Save', shortcut: '⌘S' },
      { value: 'save-as', label: 'Save As…', shortcut: '⇧⌘S' },
      { value: 'divider-2', label: '', divider: true },
      { value: 'quit', label: 'Quit', shortcut: '⌘Q' },
    ],
  },
  {
    value: 'edit',
    label: 'Edit',
    children: [
      { value: 'undo', label: 'Undo', shortcut: '⌘Z' },
      { value: 'redo', label: 'Redo', shortcut: '⇧⌘Z' },
      { value: 'divider-edit-1', label: '', divider: true },
      { value: 'cut', label: 'Cut', shortcut: '⌘X' },
      { value: 'copy', label: 'Copy', shortcut: '⌘C' },
      { value: 'paste', label: 'Paste', shortcut: '⌘V' },
    ],
  },
  {
    value: 'view',
    label: 'View',
    children: [
      { value: 'zoom-in', label: 'Zoom In', shortcut: '⌘+' },
      { value: 'zoom-out', label: 'Zoom Out', shortcut: '⌘-' },
      { value: 'divider-view-1', label: '', divider: true },
      {
        value: 'fullscreen',
        label: 'Enter Full Screen',
        shortcut: '⌃⌘F',
      },
    ],
  },
  {
    value: 'help',
    label: 'Help',
    children: [
      { value: 'docs', label: 'Documentation' },
      { value: 'shortcuts', label: 'Keyboard Shortcuts' },
      { value: 'divider-help-1', label: '', divider: true },
      { value: 'about', label: 'About' },
    ],
  },
]
</script>

<template>
  <VMenuBar :items="items" aria-label="Application menu" />
</template>

Subtle

Variação Subtle. Props: variant="subtle".

Ver código
vue
<script setup lang="ts">
import { VMenuBar } from 'vueui-nova-kit'

const items = [
  {
    value: 'file',
    label: 'File',
    children: [
      { value: 'new', label: 'New', shortcut: '⌘N' },
      { value: 'open', label: 'Open…', shortcut: '⌘O' },
      { value: 'divider-1', label: '', divider: true },
      { value: 'save', label: 'Save', shortcut: '⌘S' },
      { value: 'save-as', label: 'Save As…', shortcut: '⇧⌘S' },
      { value: 'divider-2', label: '', divider: true },
      { value: 'quit', label: 'Quit', shortcut: '⌘Q' },
    ],
  },
  {
    value: 'edit',
    label: 'Edit',
    children: [
      { value: 'undo', label: 'Undo', shortcut: '⌘Z' },
      { value: 'redo', label: 'Redo', shortcut: '⇧⌘Z' },
      { value: 'divider-edit-1', label: '', divider: true },
      { value: 'cut', label: 'Cut', shortcut: '⌘X' },
      { value: 'copy', label: 'Copy', shortcut: '⌘C' },
      { value: 'paste', label: 'Paste', shortcut: '⌘V' },
    ],
  },
  {
    value: 'view',
    label: 'View',
    children: [
      { value: 'zoom-in', label: 'Zoom In', shortcut: '⌘+' },
      { value: 'zoom-out', label: 'Zoom Out', shortcut: '⌘-' },
      { value: 'divider-view-1', label: '', divider: true },
      {
        value: 'fullscreen',
        label: 'Enter Full Screen',
        shortcut: '⌃⌘F',
      },
    ],
  },
  {
    value: 'help',
    label: 'Help',
    children: [
      { value: 'docs', label: 'Documentation' },
      { value: 'shortcuts', label: 'Keyboard Shortcuts' },
      { value: 'divider-help-1', label: '', divider: true },
      { value: 'about', label: 'About' },
    ],
  },
]
</script>

<template>
  <VMenuBar variant="subtle" :items="items" aria-label="Application menu" />
</template>

Small

Variação Pequeno. Props: size="sm".

Ver código
vue
<script setup lang="ts">
import { VMenuBar } from 'vueui-nova-kit'

const items = [
  {
    value: 'file',
    label: 'File',
    children: [
      { value: 'new', label: 'New', shortcut: '⌘N' },
      { value: 'open', label: 'Open…', shortcut: '⌘O' },
      { value: 'divider-1', label: '', divider: true },
      { value: 'save', label: 'Save', shortcut: '⌘S' },
      { value: 'save-as', label: 'Save As…', shortcut: '⇧⌘S' },
      { value: 'divider-2', label: '', divider: true },
      { value: 'quit', label: 'Quit', shortcut: '⌘Q' },
    ],
  },
  {
    value: 'edit',
    label: 'Edit',
    children: [
      { value: 'undo', label: 'Undo', shortcut: '⌘Z' },
      { value: 'redo', label: 'Redo', shortcut: '⇧⌘Z' },
      { value: 'divider-edit-1', label: '', divider: true },
      { value: 'cut', label: 'Cut', shortcut: '⌘X' },
      { value: 'copy', label: 'Copy', shortcut: '⌘C' },
      { value: 'paste', label: 'Paste', shortcut: '⌘V' },
    ],
  },
  {
    value: 'view',
    label: 'View',
    children: [
      { value: 'zoom-in', label: 'Zoom In', shortcut: '⌘+' },
      { value: 'zoom-out', label: 'Zoom Out', shortcut: '⌘-' },
      { value: 'divider-view-1', label: '', divider: true },
      {
        value: 'fullscreen',
        label: 'Enter Full Screen',
        shortcut: '⌃⌘F',
      },
    ],
  },
  {
    value: 'help',
    label: 'Help',
    children: [
      { value: 'docs', label: 'Documentation' },
      { value: 'shortcuts', label: 'Keyboard Shortcuts' },
      { value: 'divider-help-1', label: '', divider: true },
      { value: 'about', label: 'About' },
    ],
  },
]
</script>

<template>
  <VMenuBar size="sm" :items="items" aria-label="Application menu" />
</template>

Large

Variação Grande. Props: size="lg".

Ver código
vue
<script setup lang="ts">
import { VMenuBar } from 'vueui-nova-kit'

const items = [
  {
    value: 'file',
    label: 'File',
    children: [
      { value: 'new', label: 'New', shortcut: '⌘N' },
      { value: 'open', label: 'Open…', shortcut: '⌘O' },
      { value: 'divider-1', label: '', divider: true },
      { value: 'save', label: 'Save', shortcut: '⌘S' },
      { value: 'save-as', label: 'Save As…', shortcut: '⇧⌘S' },
      { value: 'divider-2', label: '', divider: true },
      { value: 'quit', label: 'Quit', shortcut: '⌘Q' },
    ],
  },
  {
    value: 'edit',
    label: 'Edit',
    children: [
      { value: 'undo', label: 'Undo', shortcut: '⌘Z' },
      { value: 'redo', label: 'Redo', shortcut: '⇧⌘Z' },
      { value: 'divider-edit-1', label: '', divider: true },
      { value: 'cut', label: 'Cut', shortcut: '⌘X' },
      { value: 'copy', label: 'Copy', shortcut: '⌘C' },
      { value: 'paste', label: 'Paste', shortcut: '⌘V' },
    ],
  },
  {
    value: 'view',
    label: 'View',
    children: [
      { value: 'zoom-in', label: 'Zoom In', shortcut: '⌘+' },
      { value: 'zoom-out', label: 'Zoom Out', shortcut: '⌘-' },
      { value: 'divider-view-1', label: '', divider: true },
      {
        value: 'fullscreen',
        label: 'Enter Full Screen',
        shortcut: '⌃⌘F',
      },
    ],
  },
  {
    value: 'help',
    label: 'Help',
    children: [
      { value: 'docs', label: 'Documentation' },
      { value: 'shortcuts', label: 'Keyboard Shortcuts' },
      { value: 'divider-help-1', label: '', divider: true },
      { value: 'about', label: 'About' },
    ],
  },
]
</script>

<template>
  <VMenuBar size="lg" :items="items" aria-label="Application menu" />
</template>

Disabled

Variação Desabilitado. Props: disabled=true.

Ver código
vue
<script setup lang="ts">
import { VMenuBar } from 'vueui-nova-kit'

const items = [
  {
    value: 'file',
    label: 'File',
    children: [
      { value: 'new', label: 'New', shortcut: '⌘N' },
      { value: 'open', label: 'Open…', shortcut: '⌘O' },
      { value: 'divider-1', label: '', divider: true },
      { value: 'save', label: 'Save', shortcut: '⌘S' },
      { value: 'save-as', label: 'Save As…', shortcut: '⇧⌘S' },
      { value: 'divider-2', label: '', divider: true },
      { value: 'quit', label: 'Quit', shortcut: '⌘Q' },
    ],
  },
  {
    value: 'edit',
    label: 'Edit',
    children: [
      { value: 'undo', label: 'Undo', shortcut: '⌘Z' },
      { value: 'redo', label: 'Redo', shortcut: '⇧⌘Z' },
      { value: 'divider-edit-1', label: '', divider: true },
      { value: 'cut', label: 'Cut', shortcut: '⌘X' },
      { value: 'copy', label: 'Copy', shortcut: '⌘C' },
      { value: 'paste', label: 'Paste', shortcut: '⌘V' },
    ],
  },
  {
    value: 'view',
    label: 'View',
    children: [
      { value: 'zoom-in', label: 'Zoom In', shortcut: '⌘+' },
      { value: 'zoom-out', label: 'Zoom Out', shortcut: '⌘-' },
      { value: 'divider-view-1', label: '', divider: true },
      {
        value: 'fullscreen',
        label: 'Enter Full Screen',
        shortcut: '⌃⌘F',
      },
    ],
  },
  {
    value: 'help',
    label: 'Help',
    children: [
      { value: 'docs', label: 'Documentation' },
      { value: 'shortcuts', label: 'Keyboard Shortcuts' },
      { value: 'divider-help-1', label: '', divider: true },
      { value: 'about', label: 'About' },
    ],
  },
]
</script>

<template>
  <VMenuBar :items="items" aria-label="Application menu" disabled />
</template>

Loading

Variação Carregando. Props: loading=true.

Ver código
vue
<script setup lang="ts">
import { VMenuBar } from 'vueui-nova-kit'

const items = [
  {
    value: 'file',
    label: 'File',
    children: [
      { value: 'new', label: 'New', shortcut: '⌘N' },
      { value: 'open', label: 'Open…', shortcut: '⌘O' },
      { value: 'divider-1', label: '', divider: true },
      { value: 'save', label: 'Save', shortcut: '⌘S' },
      { value: 'save-as', label: 'Save As…', shortcut: '⇧⌘S' },
      { value: 'divider-2', label: '', divider: true },
      { value: 'quit', label: 'Quit', shortcut: '⌘Q' },
    ],
  },
  {
    value: 'edit',
    label: 'Edit',
    children: [
      { value: 'undo', label: 'Undo', shortcut: '⌘Z' },
      { value: 'redo', label: 'Redo', shortcut: '⇧⌘Z' },
      { value: 'divider-edit-1', label: '', divider: true },
      { value: 'cut', label: 'Cut', shortcut: '⌘X' },
      { value: 'copy', label: 'Copy', shortcut: '⌘C' },
      { value: 'paste', label: 'Paste', shortcut: '⌘V' },
    ],
  },
  {
    value: 'view',
    label: 'View',
    children: [
      { value: 'zoom-in', label: 'Zoom In', shortcut: '⌘+' },
      { value: 'zoom-out', label: 'Zoom Out', shortcut: '⌘-' },
      { value: 'divider-view-1', label: '', divider: true },
      {
        value: 'fullscreen',
        label: 'Enter Full Screen',
        shortcut: '⌃⌘F',
      },
    ],
  },
  {
    value: 'help',
    label: 'Help',
    children: [
      { value: 'docs', label: 'Documentation' },
      { value: 'shortcuts', label: 'Keyboard Shortcuts' },
      { value: 'divider-help-1', label: '', divider: true },
      { value: 'about', label: 'About' },
    ],
  },
]
</script>

<template>
  <VMenuBar :items="items" aria-label="Application menu" loading />
</template>

Hover Open

Variação Hover aberto. Props: openOnHover=true.

Ver código
vue
<script setup lang="ts">
import { VMenuBar } from 'vueui-nova-kit'

const items = [
  {
    value: 'file',
    label: 'File',
    children: [
      { value: 'new', label: 'New', shortcut: '⌘N' },
      { value: 'open', label: 'Open…', shortcut: '⌘O' },
      { value: 'divider-1', label: '', divider: true },
      { value: 'save', label: 'Save', shortcut: '⌘S' },
      { value: 'save-as', label: 'Save As…', shortcut: '⇧⌘S' },
      { value: 'divider-2', label: '', divider: true },
      { value: 'quit', label: 'Quit', shortcut: '⌘Q' },
    ],
  },
  {
    value: 'edit',
    label: 'Edit',
    children: [
      { value: 'undo', label: 'Undo', shortcut: '⌘Z' },
      { value: 'redo', label: 'Redo', shortcut: '⇧⌘Z' },
      { value: 'divider-edit-1', label: '', divider: true },
      { value: 'cut', label: 'Cut', shortcut: '⌘X' },
      { value: 'copy', label: 'Copy', shortcut: '⌘C' },
      { value: 'paste', label: 'Paste', shortcut: '⌘V' },
    ],
  },
  {
    value: 'view',
    label: 'View',
    children: [
      { value: 'zoom-in', label: 'Zoom In', shortcut: '⌘+' },
      { value: 'zoom-out', label: 'Zoom Out', shortcut: '⌘-' },
      { value: 'divider-view-1', label: '', divider: true },
      {
        value: 'fullscreen',
        label: 'Enter Full Screen',
        shortcut: '⌃⌘F',
      },
    ],
  },
  {
    value: 'help',
    label: 'Help',
    children: [
      { value: 'docs', label: 'Documentation' },
      { value: 'shortcuts', label: 'Keyboard Shortcuts' },
      { value: 'divider-help-1', label: '', divider: true },
      { value: 'about', label: 'About' },
    ],
  },
]
</script>

<template>
  <VMenuBar :items="items" aria-label="Application menu" open-on-hover />
</template>

Open On Hover

Variação Aberto em hover. Props: openOnHover=true, hoverDelay=150.

Ver código
vue
<script setup lang="ts">
import { VMenuBar } from 'vueui-nova-kit'

const items = [
  {
    value: 'file',
    label: 'File',
    children: [
      { value: 'new', label: 'New', shortcut: '⌘N' },
      { value: 'open', label: 'Open…', shortcut: '⌘O' },
      { value: 'divider-1', label: '', divider: true },
      { value: 'save', label: 'Save', shortcut: '⌘S' },
      { value: 'save-as', label: 'Save As…', shortcut: '⇧⌘S' },
      { value: 'divider-2', label: '', divider: true },
      { value: 'quit', label: 'Quit', shortcut: '⌘Q' },
    ],
  },
  {
    value: 'edit',
    label: 'Edit',
    children: [
      { value: 'undo', label: 'Undo', shortcut: '⌘Z' },
      { value: 'redo', label: 'Redo', shortcut: '⇧⌘Z' },
      { value: 'divider-edit-1', label: '', divider: true },
      { value: 'cut', label: 'Cut', shortcut: '⌘X' },
      { value: 'copy', label: 'Copy', shortcut: '⌘C' },
      { value: 'paste', label: 'Paste', shortcut: '⌘V' },
    ],
  },
  {
    value: 'view',
    label: 'View',
    children: [
      { value: 'zoom-in', label: 'Zoom In', shortcut: '⌘+' },
      { value: 'zoom-out', label: 'Zoom Out', shortcut: '⌘-' },
      { value: 'divider-view-1', label: '', divider: true },
      {
        value: 'fullscreen',
        label: 'Enter Full Screen',
        shortcut: '⌃⌘F',
      },
    ],
  },
  {
    value: 'help',
    label: 'Help',
    children: [
      { value: 'docs', label: 'Documentation' },
      { value: 'shortcuts', label: 'Keyboard Shortcuts' },
      { value: 'divider-help-1', label: '', divider: true },
      { value: 'about', label: 'About' },
    ],
  },
]
</script>

<template>
  <VMenuBar :items="items" aria-label="Application menu" open-on-hover />
</template>

Acessibilidade

Semântica nativa primeiro, foco visível, labels acessíveis e teclado conforme o padrão WAI-ARIA correspondente.

Estados

Default · Hover · Focus-visible · Pressed/Active quando aplicável · Disabled · Loading quando aplicável.

Motion

TriggerPropertyDurationEasing
Hoverbackground/transform100msstandard
Focusoutline/box-shadow100msstandard
Enter/Exitopacity/transform160msstandard

Respeitar prefers-reduced-motion.

Todas as transições respeitam prefers-reduced-motion e os tokens --v-duration-*.

Props

PropTipoDefaultDescrição
itemsVMenuBarMenu[]——
disabledbooleanfalse—
loadingbooleanfalse—
sizeVMenuBarSize"md"—
variantVMenuBarVariant"default"—
ariaLabelstring——
openOnHoverbooleanfalse—
hoverDelaynumber150—

Events

EventoPayloadDescrição
@selectvalue: string—
@open-changevalue: string | null—

Slots

SlotProps do slot
#default—

Fonte: src/components/navigation/VMenuBar/VMenuBar.vue · tipos: src/components/navigation/VMenuBar/VMenuBar.types.ts