Navegação
VTreeNavigation
Explorador hierárquico expansível para file systems, settings, documentação e qualquer conteúdo nested.
<script setup lang="ts">
import { VTreeNavigation } from 'vueui-nova-kit'
</script>Uso
<script setup lang="ts">
import { VTreeNavigation } from 'vueui-nova-kit'
</script>
<template>
<VTreeNavigation size="md" variant="file" showCounts active="vueui-nova" />
</template>Playground
Os controles abaixo são gerados a partir das props declaradas em VTreeNavigation.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 { VTreeNavigation } from 'vueui-nova-kit'
const items = [
{
key: 'workspace',
label: 'Workspace',
icon: 'folder',
count: 12,
children: [
{
key: 'projects',
label: 'Projects',
icon: 'folder',
count: 8,
children: [
{
key: 'vueui-nova',
label: 'vueui-nova',
icon: 'folder',
count: 3,
},
{
key: 'marketing',
label: 'marketing',
icon: 'folder',
count: 2,
},
{
key: 'design-system',
label: 'design-system',
icon: 'folder',
count: 3,
},
],
},
{ key: 'resources', label: 'Resources', icon: 'folder' },
{
key: 'documentation',
label: 'Documentation',
icon: 'book',
children: [
{
key: 'getting-started',
label: 'Getting Started',
icon: 'doc',
},
{
key: 'components',
label: 'Components',
icon: 'doc',
count: 24,
},
{ key: 'guides', label: 'Guides', icon: 'doc', count: 12 },
{
key: 'changelog',
label: 'Changelog',
icon: 'doc',
count: 5,
},
],
},
],
},
{ key: 'trash', label: 'Trash', icon: 'trash', count: 4 },
]
</script>
<template>
<VTreeNavigation :items="items" active="vueui-nova" />
</template>File Tree
Variação File Tree. Props: variant="file", active="work".
Ver código
<script setup lang="ts">
import { VTreeNavigation } from 'vueui-nova-kit'
const items = [
{
key: 'documents',
label: 'Documents',
icon: 'folder',
children: [
{ key: 'photos', label: 'Photos', icon: 'folder' },
{ key: 'work', label: 'Work', icon: 'folder' },
],
},
{ key: 'notes', label: 'Notes.txt', icon: 'file' },
]
const expandedKeys = ['documents']
</script>
<template>
<VTreeNavigation
:items="items"
active="work"
:expanded-keys="expandedKeys" />
</template>Settings Tree
Variação Settings Tree. Props: variant="settings", active="appearance", showCounts=false.
Ver código
<script setup lang="ts">
import { VTreeNavigation } from 'vueui-nova-kit'
const items = [
{
key: 'appearance',
label: 'Appearance',
icon: 'settings',
},
{
key: 'notifications',
label: 'Notifications',
icon: 'settings',
},
{ key: 'privacy', label: 'Privacy', icon: 'settings' },
{ key: 'advanced', label: 'Advanced', icon: 'settings' },
]
</script>
<template>
<VTreeNavigation
variant="settings"
:show-counts="false"
:items="items"
active="appearance" />
</template>Documentation Tree
Variação Documentation Tree. Props: variant="documentation", active="components", showCounts=false.
Ver código
<script setup lang="ts">
import { VTreeNavigation } from 'vueui-nova-kit'
const items = [
{
key: 'introduction',
label: 'Introduction',
icon: 'book',
},
{ key: 'components', label: 'Components', icon: 'book' },
{ key: 'guides', label: 'Guides', icon: 'book' },
{
key: 'api-reference',
label: 'API Reference',
icon: 'book',
},
]
</script>
<template>
<VTreeNavigation
variant="documentation"
:show-counts="false"
:items="items"
active="components" />
</template>Simple Tree
Variação Simple Tree. Props: variant="simple", active="home", showCounts=false.
Ver código
<script setup lang="ts">
import { VTreeNavigation } from 'vueui-nova-kit'
const items = [
{ key: 'home', label: 'Home', icon: 'home' },
{ key: 'about', label: 'About', icon: 'star' },
{ key: 'services', label: 'Services', icon: 'star' },
{ key: 'contact', label: 'Contact', icon: 'contact' },
]
</script>
<template>
<VTreeNavigation
variant="simple"
:show-counts="false"
:items="items"
active="home" />
</template>Small
Variação Pequeno. Props: size="sm".
Ver código
<script setup lang="ts">
import { VTreeNavigation } from 'vueui-nova-kit'
const items = [
{
key: 'workspace',
label: 'Workspace',
icon: 'folder',
count: 12,
children: [
{
key: 'projects',
label: 'Projects',
icon: 'folder',
count: 8,
children: [
{
key: 'vueui-nova',
label: 'vueui-nova',
icon: 'folder',
count: 3,
},
{
key: 'marketing',
label: 'marketing',
icon: 'folder',
count: 2,
},
{
key: 'design-system',
label: 'design-system',
icon: 'folder',
count: 3,
},
],
},
{ key: 'resources', label: 'Resources', icon: 'folder' },
{
key: 'documentation',
label: 'Documentation',
icon: 'book',
children: [
{
key: 'getting-started',
label: 'Getting Started',
icon: 'doc',
},
{
key: 'components',
label: 'Components',
icon: 'doc',
count: 24,
},
{ key: 'guides', label: 'Guides', icon: 'doc', count: 12 },
{
key: 'changelog',
label: 'Changelog',
icon: 'doc',
count: 5,
},
],
},
],
},
{ key: 'trash', label: 'Trash', icon: 'trash', count: 4 },
]
</script>
<template>
<VTreeNavigation size="sm" :items="items" active="vueui-nova" />
</template>Large
Variação Grande. Props: size="lg".
Ver código
<script setup lang="ts">
import { VTreeNavigation } from 'vueui-nova-kit'
const items = [
{
key: 'workspace',
label: 'Workspace',
icon: 'folder',
count: 12,
children: [
{
key: 'projects',
label: 'Projects',
icon: 'folder',
count: 8,
children: [
{
key: 'vueui-nova',
label: 'vueui-nova',
icon: 'folder',
count: 3,
},
{
key: 'marketing',
label: 'marketing',
icon: 'folder',
count: 2,
},
{
key: 'design-system',
label: 'design-system',
icon: 'folder',
count: 3,
},
],
},
{ key: 'resources', label: 'Resources', icon: 'folder' },
{
key: 'documentation',
label: 'Documentation',
icon: 'book',
children: [
{
key: 'getting-started',
label: 'Getting Started',
icon: 'doc',
},
{
key: 'components',
label: 'Components',
icon: 'doc',
count: 24,
},
{ key: 'guides', label: 'Guides', icon: 'doc', count: 12 },
{
key: 'changelog',
label: 'Changelog',
icon: 'doc',
count: 5,
},
],
},
],
},
{ key: 'trash', label: 'Trash', icon: 'trash', count: 4 },
]
</script>
<template>
<VTreeNavigation size="lg" :items="items" active="vueui-nova" />
</template>Multiple
Variação Múltiplo. Props: multiple=true.
Ver código
<script setup lang="ts">
import { VTreeNavigation } from 'vueui-nova-kit'
const items = [
{
key: 'workspace',
label: 'Workspace',
icon: 'folder',
count: 12,
children: [
{
key: 'projects',
label: 'Projects',
icon: 'folder',
count: 8,
children: [
{
key: 'vueui-nova',
label: 'vueui-nova',
icon: 'folder',
count: 3,
},
{
key: 'marketing',
label: 'marketing',
icon: 'folder',
count: 2,
},
{
key: 'design-system',
label: 'design-system',
icon: 'folder',
count: 3,
},
],
},
{ key: 'resources', label: 'Resources', icon: 'folder' },
{
key: 'documentation',
label: 'Documentation',
icon: 'book',
children: [
{
key: 'getting-started',
label: 'Getting Started',
icon: 'doc',
},
{
key: 'components',
label: 'Components',
icon: 'doc',
count: 24,
},
{ key: 'guides', label: 'Guides', icon: 'doc', count: 12 },
{
key: 'changelog',
label: 'Changelog',
icon: 'doc',
count: 5,
},
],
},
],
},
{ key: 'trash', label: 'Trash', icon: 'trash', count: 4 },
]
const active = ['vueui-nova', 'components']
</script>
<template>
<VTreeNavigation :items="items" :active="active" multiple />
</template>Disabled
Variação Desabilitado. Props: disabled=true.
Ver código
<script setup lang="ts">
import { VTreeNavigation } from 'vueui-nova-kit'
const items = [
{
key: 'workspace',
label: 'Workspace',
icon: 'folder',
count: 12,
children: [
{
key: 'projects',
label: 'Projects',
icon: 'folder',
count: 8,
children: [
{
key: 'vueui-nova',
label: 'vueui-nova',
icon: 'folder',
count: 3,
},
{
key: 'marketing',
label: 'marketing',
icon: 'folder',
count: 2,
},
{
key: 'design-system',
label: 'design-system',
icon: 'folder',
count: 3,
},
],
},
{ key: 'resources', label: 'Resources', icon: 'folder' },
{
key: 'documentation',
label: 'Documentation',
icon: 'book',
children: [
{
key: 'getting-started',
label: 'Getting Started',
icon: 'doc',
},
{
key: 'components',
label: 'Components',
icon: 'doc',
count: 24,
},
{ key: 'guides', label: 'Guides', icon: 'doc', count: 12 },
{
key: 'changelog',
label: 'Changelog',
icon: 'doc',
count: 5,
},
],
},
],
},
{ key: 'trash', label: 'Trash', icon: 'trash', count: 4 },
]
</script>
<template>
<VTreeNavigation :items="items" active="vueui-nova" disabled />
</template>Loading
Variação Carregando. Props: loading=true.
Ver código
<script setup lang="ts">
import { VTreeNavigation } from 'vueui-nova-kit'
const items = [
{
key: 'workspace',
label: 'Workspace',
icon: 'folder',
count: 12,
children: [
{
key: 'projects',
label: 'Projects',
icon: 'folder',
count: 8,
children: [
{
key: 'vueui-nova',
label: 'vueui-nova',
icon: 'folder',
count: 3,
},
{
key: 'marketing',
label: 'marketing',
icon: 'folder',
count: 2,
},
{
key: 'design-system',
label: 'design-system',
icon: 'folder',
count: 3,
},
],
},
{ key: 'resources', label: 'Resources', icon: 'folder' },
{
key: 'documentation',
label: 'Documentation',
icon: 'book',
children: [
{
key: 'getting-started',
label: 'Getting Started',
icon: 'doc',
},
{
key: 'components',
label: 'Components',
icon: 'doc',
count: 24,
},
{ key: 'guides', label: 'Guides', icon: 'doc', count: 12 },
{
key: 'changelog',
label: 'Changelog',
icon: 'doc',
count: 5,
},
],
},
],
},
{ key: 'trash', label: 'Trash', icon: 'trash', count: 4 },
]
</script>
<template>
<VTreeNavigation :items="items" active="vueui-nova" loading />
</template>Lazy Children
Variação Lazy Children. Props: lazy=true, active="root".
Ver código
<script setup lang="ts">
import { VTreeNavigation } from 'vueui-nova-kit'
const items = [
{
key: 'root',
label: 'Raiz (carrega filhos ao expandir)',
lazy: true,
children: [],
},
]
</script>
<template>
<VTreeNavigation :items="items" active="root" lazy />
</template>Acessibilidade
role="tree"no container,role="treeitem"nos nósaria-expanded,aria-selected,aria-level- Teclado: Arrow keys, Enter, Space, Home, End
- Foco visível com
--v-tree-focus-ring-* - Suporta seleção single e multiple (
aria-multiselectable)
Estados
Collapsed · Expanded · Hover · Focus-visible · Selected · Disabled · Loading (lazy children)
Motion
| Trigger | Property | Duration | Easing |
|---|---|---|---|
| Expand | height/opacity/chevron | 200ms | ease-out |
| Collapse | height/opacity/chevron | 200ms | ease-in |
| Hover | background | 200ms | ease-out |
| Focus | outline | 200ms | ease-out |
Respeitar prefers-reduced-motion.
Todas as transições respeitam prefers-reduced-motion e os tokens --v-duration-*.
Props
| Prop | Tipo | Default | Descrição |
|---|---|---|---|
active | string | string[] | — | — |
expandedKeys | string[] | — | — |
items | VTreeNavigationItem[] | — | — |
multiple | boolean | false | — |
showCounts | boolean | true | — |
iconField | string | "icon" | — |
lazy | boolean | false | — |
loadChildren | (node: VTreeNavigationItem) => Promise<VTreeNavigationItem[]> | — | — |
disabled | boolean | false | — |
loading | boolean | false | — |
size | VTreeNavigationSize | "md" | — |
variant | VTreeNavigationVariant | 'default' | 'primary' | 'subtle' | "file" | — |
ariaLabel | string | — | — |
Events
| Evento | Payload | Descrição |
|---|---|---|
@update:active | value: string | string[] | — |
@update:expandedKeys | value: string[] | — |
@select | value: string | string[] | — |
Slots
| Slot | Props do slot |
|---|---|
#default | — |
Fonte: src/components/navigation/VTreeNavigation/VTreeNavigation.vue · tipos: src/components/navigation/VTreeNavigation/VTreeNavigation.types.ts