Seleção e menus
VMenuBar
Componente VueUI Nova para **menu bar**, seguindo tokens semânticos e Light Mode como referência principal.
<script setup lang="ts">
import { VMenuBar } from 'vueui-nova-kit'
</script>Uso
<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
<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
<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
<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
<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
<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
<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
<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
<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
<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
| Trigger | Property | Duration | Easing |
|---|---|---|---|
| Hover | background/transform | 100ms | standard |
| Focus | outline/box-shadow | 100ms | standard |
| Enter/Exit | opacity/transform | 160ms | standard |
Respeitar prefers-reduced-motion.
Todas as transições respeitam prefers-reduced-motion e os tokens --v-duration-*.
Props
| Prop | Tipo | Default | Descrição |
|---|---|---|---|
items | VMenuBarMenu[] | — | — |
disabled | boolean | false | — |
loading | boolean | false | — |
size | VMenuBarSize | "md" | — |
variant | VMenuBarVariant | "default" | — |
ariaLabel | string | — | — |
openOnHover | boolean | false | — |
hoverDelay | number | 150 | — |
Events
| Evento | Payload | Descrição |
|---|---|---|
@select | value: string | — |
@open-change | value: string | null | — |
Slots
| Slot | Props do slot |
|---|---|
#default | — |
Fonte: src/components/navigation/VMenuBar/VMenuBar.vue · tipos: src/components/navigation/VMenuBar/VMenuBar.types.ts