Navegação

VTabs

Componentev-model9 exemplos8 propsA2UI · Tabs

Ajudar o utilizador a navegar entre conteúdos relacionados dentro do mesmo contexto, mantendo a informação organizada e acessível. É navegação contextual (não muda de página): alterna painéis de conteúdo relacionado (ex.: Overview/Features/Pricing/FAQ, General/Team/Billing/Integrations, Home/Analytics/Settings/Security).

Importação
<script setup lang="ts">
import { VTabs } 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 VTabs.types.ts; o código acompanha cada mudança.

Exemplos

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

Underline

Variação Underline.

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

const items = [
  { value: 'overview', label: 'Overview', icon: 'home' },
  { value: 'features', label: 'Features' },
  { value: 'pricing', label: 'Pricing' },
  { value: 'faq', label: 'FAQ' },
]
</script>

<template>
  <VTabs v-model="value" :items="items" />
</template>

Pill

Variação Pill. Props: variant="pill".

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

const items = [
  { value: 'general', label: 'General' },
  { value: 'team', label: 'Team' },
  { value: 'billing', label: 'Billing' },
  { value: 'integrations', label: 'Integrations' },
]
</script>

<template>
  <VTabs v-model="value" variant="pill" :items="items" />
</template>

Icon

Variação Ícone. Props: variant="icon".

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

const items = [
  { value: 'home', label: 'Home', icon: 'home' },
  {
    value: 'analytics',
    label: 'Analytics',
    icon: 'analytics',
  },
  { value: 'settings', label: 'Settings', icon: 'settings' },
  { value: 'security', label: 'Security', icon: 'security' },
]
</script>

<template>
  <VTabs v-model="value" variant="icon" :items="items" />
</template>

Small

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

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

const items = [
  { value: 'overview', label: 'Overview', icon: 'home' },
  { value: 'features', label: 'Features' },
  { value: 'pricing', label: 'Pricing' },
  { value: 'faq', label: 'FAQ' },
]
</script>

<template>
  <VTabs v-model="value" size="sm" :items="items" />
</template>

Large

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

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

const items = [
  { value: 'overview', label: 'Overview', icon: 'home' },
  { value: 'features', label: 'Features' },
  { value: 'pricing', label: 'Pricing' },
  { value: 'faq', label: 'FAQ' },
]
</script>

<template>
  <VTabs v-model="value" size="lg" :items="items" />
</template>

Disabled

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

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

const items = [
  { value: 'overview', label: 'Overview' },
  { value: 'features', label: 'Features', disabled: true },
]
</script>

<template>
  <VTabs v-model="value" :items="items" disabled />
</template>

Navigation With Actions

Variação Navegação com ações. Props: variant="underline", panels=false, modelValue="overview". Slots usados: #actions.

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

const args = {
  size: 'md',
  variant: 'underline',
  items: [
    {
      value: 'overview',
      label: 'Overview'
    },
    {
      value: 'holdings',
      label: 'Holdings'
    },
    {
      value: 'activity',
      label: 'Activity'
    }
  ],
  panels: false,
  modelValue: 'overview'
}
</script>

<template>
  <VTabs v-bind="args">
    <template #actions>
      <span style="font-size:12px;color:var(--v-color-text-muted)">Updated 2m ago</span>
    </template>
  </VTabs>
</template>

Dividers

Variação Dividers. Props: dividers=true.

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

const items = [
  { value: 'overview', label: 'Overview', icon: 'home' },
  { value: 'features', label: 'Features' },
  { value: 'pricing', label: 'Pricing' },
  { value: 'faq', label: 'FAQ' },
]
</script>

<template>
  <VTabs v-model="value" :items="items" dividers />
</template>

Controlled VModel

Estado controlado: v-model ligado a um ref e exibido abaixo; as abas também podem ser trocadas por código.

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

const args = {
  size: 'md',
  variant: 'underline',
  items: [
    {
      value: 'overview',
      label: 'Overview',
      icon: 'home'
    },
    {
      value: 'features',
      label: 'Features'
    },
    {
      value: 'pricing',
      label: 'Pricing'
    },
    {
      value: 'faq',
      label: 'FAQ'
    }
  ]
}
const tab = ref('features')
</script>

<template>
  <div style="display:grid;gap:12px"><VTabs v-bind="args" v-model="tab" /><code>v-model = {{ tab }}</code><VButton variant="ghost" size="sm" @click="tab = 'pricing'">Ir para Pricing</VButton></div>
</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
modelValuestring——
itemsVTabItem[]——
disabledbooleanfalse—
sizeVTabsSize"md"—
variantVTabsVariant"underline"—
dividersbooleanfalse—
panelsbooleantrueRenders the tabpanel area. Set `false` to use tabs as navigation (no tabpanel/aria-controls). Default `true`.
ariaLabelstring——

Events

EventoPayloadDescrição
@update:modelValuevalue: string—

Slots

SlotProps do slot
#actions—
#default—

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