Navegação
VTopBar
Chrome global do app: logo, navegação principal e ações globais no topo da aplicação.
<script setup lang="ts">
import { VTopBar } 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 VTopBar.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. Slots usados: #leading, #actions.
Ver código
<script setup lang="ts">
import { VTopBar, VButton } from 'vueui-nova-kit'
const args = {
size: 'md',
variant: 'default',
bordered: true,
ariaLabel: 'Application header'
}
</script>
<template>
<VTopBar v-bind="args">
<template #leading>
<span style="display:inline-flex;align-items:center;gap:8px;font-weight:600;">
<span style="width:24px;height:24px;border-radius:6px;background:var(--v-color-primary);display:inline-block;"></span>
Acme
</span>
</template>
<nav style="display:flex;gap:16px;color:var(--v-color-text-muted);font-size:14px;">
<span style="color:var(--v-color-primary);font-weight:600;">Dashboard</span>
<span>Projects</span>
<span>Settings</span>
</nav>
<template #actions>
<VButton variant="outline" size="sm">Help</VButton>
<span style="width:32px;height:32px;border-radius:var(--v-radius-circle);background:var(--v-color-neutral-200);display:inline-flex;align-items:center;justify-content:center;font-size:12px;font-weight:600;">AC</span>
</template>
</VTopBar>
</template>Title Only
Variação Título somente. Props: title="Projects".
Ver código
<script setup lang="ts">
import { VTopBar } from 'vueui-nova-kit'
</script>
<template>
<VTopBar aria-label="Application header" title="Projects" />
</template>Subtle
Variação Subtle. Props: variant="subtle", bordered=false. Slots usados: #actions.
Ver código
<script setup lang="ts">
import { VTopBar, VButton } from 'vueui-nova-kit'
const args = {
size: 'md',
variant: 'subtle',
bordered: false,
ariaLabel: 'Application header'
}
</script>
<template>
<VTopBar v-bind="args" title="Editor workspace">
<template #actions>
<VButton variant="primary" size="sm">Share</VButton>
</template>
</VTopBar>
</template>App
Variação App. Props: variant="app", activeItem="traces", bordered=true. Slots usados: #leading, #actions.
Ver código
<script setup lang="ts">
import { VTopBar } from 'vueui-nova-kit'
const args = {
size: 'md',
variant: 'app',
bordered: true,
ariaLabel: 'Application header',
items: [
{
value: 'overview',
label: 'Overview'
},
{
value: 'workflows',
label: 'Workflows'
},
{
value: 'map',
label: 'Live Map'
},
{
value: 'traces',
label: 'Traces'
},
{
value: 'incidents',
label: 'Incidents'
},
{
value: 'insights',
label: 'Insights'
}
],
activeItem: 'traces'
}
</script>
<template>
<VTopBar v-bind="args">
<template #leading>
<span style="display:inline-flex;align-items:center;gap:8px;font-weight:600;">
<span style="width:28px;height:28px;border-radius:8px;background:var(--v-color-primary-500);display:inline-block;"></span>
OrchestrateIQ
</span>
</template>
<template #actions>
<span style="padding:4px 10px;border-radius:999px;background:var(--v-color-success-soft);color:var(--v-color-success-strong);font-size:12px;font-weight:600;">Live</span>
<span style="width:32px;height:32px;border-radius:999px;background:var(--v-color-neutral-200);display:inline-flex;align-items:center;justify-content:center;font-size:12px;font-weight:600;">PT</span>
</template>
</VTopBar>
</template>Primary
Variação Primária. Props: variant="primary". Slots usados: #actions.
Ver código
<script setup lang="ts">
import { VTopBar, VButton } from 'vueui-nova-kit'
const args = {
size: 'md',
variant: 'primary',
bordered: true,
ariaLabel: 'Application header'
}
</script>
<template>
<VTopBar v-bind="args" title="Marketing dashboard">
<template #actions>
<VButton variant="ghost" size="sm">Upgrade</VButton>
</template>
</VTopBar>
</template>Sticky
Variação Sticky. Props: sticky=true. Slots usados: #actions.
Ver código
<script setup lang="ts">
import { VTopBar, VButton } from 'vueui-nova-kit'
const args = {
size: 'md',
variant: 'default',
bordered: true,
ariaLabel: 'Application header',
sticky: true
}
</script>
<template>
<div style="height:240px;overflow:auto;border:1px solid var(--v-color-border);border-radius:8px;">
<VTopBar v-bind="args" title="Scrollable page">
<template #actions><VButton variant="secondary" size="sm">Action</VButton></template>
</VTopBar>
<div style="padding:24px;">Conteúdo longo para demonstrar sticky header…</div>
<div style="height:480px;padding:24px;">Mais conteúdo</div>
</div>
</template>Disabled
Variação Desabilitado. Props: disabled=true, title="Disabled header".
Ver código
<script setup lang="ts">
import { VTopBar } from 'vueui-nova-kit'
</script>
<template>
<VTopBar
aria-label="Application header"
disabled
title="Disabled header" />
</template>Loading
Variação Carregando. Props: loading=true, title="Loading header".
Ver código
<script setup lang="ts">
import { VTopBar } from 'vueui-nova-kit'
</script>
<template>
<VTopBar aria-label="Application header" loading title="Loading header" />
</template>Sizes
Variação Tamanhos.
Ver código
<script setup lang="ts">
import { VTopBar } from 'vueui-nova-kit'
</script>
<template>
<div style="display:flex;flex-direction:column;gap:12px;">
<VTopBar size="sm" title="Small top bar" />
<VTopBar size="md" title="Medium top bar" />
<VTopBar size="lg" title="Large top bar" />
</div>
</template>Narrow Overflow
Variação Estreito overflow. Props: variant="app", activeItem="settings", bordered=true. Slots usados: #leading.
Ver código
<script setup lang="ts">
import { VTopBar } from 'vueui-nova-kit'
const args = {
size: 'md',
variant: 'app',
bordered: true,
ariaLabel: 'Application header',
items: [
{
value: 'overview',
label: 'Overview'
},
{
value: 'workflows',
label: 'Workflows'
},
{
value: 'map',
label: 'Live Map'
},
{
value: 'traces',
label: 'Traces'
},
{
value: 'incidents',
label: 'Incidents'
},
{
value: 'insights',
label: 'Insights'
},
{
value: 'alerts',
label: 'Alerts'
},
{
value: 'settings',
label: 'Settings'
}
],
activeItem: 'settings'
}
</script>
<template>
<div style="width:360px;border:1px dashed var(--v-color-border)"><VTopBar v-bind="args"><template #leading><strong>Acme</strong></template></VTopBar></div>
</template>Acessibilidade
<header role="banner">como root- Título principal via
<h1>quando usa proptitle - Estados
disabledeloadingcomaria-disabled/aria-busy
Props
| Prop | Tipo | Default | Descrição |
|---|---|---|---|
title | string | — | — |
disabled | boolean | false | — |
loading | boolean | false | — |
bordered | boolean | true | — |
sticky | boolean | false | — |
size | VTopBarSize | "md" | — |
variant | VTopBarVariant | "default" | — |
items | VTopBarItem[] | [] | Center navigation. The active item renders as a solid pill. |
activeItem | string | — | — |
ariaLabel | string | — | — |
Events
| Evento | Payload | Descrição |
|---|---|---|
@select | value: string | — |
@update:activeItem | value: string | — |
Slots
| Slot | Props do slot |
|---|---|
#leading | — |
#default | — |
#actions | — |
Fonte: src/components/navigation/VTopBar/VTopBar.vue · tipos: src/components/navigation/VTopBar/VTopBar.types.ts