Dados e tabelas
VGroupedTable
Tabela agrupada e responsiva ao **container** (não à viewport): colunas aparecem/somem conforme a largura do painel e podem "colapsar" inline na coluna principal — o padrão "tables that split, stretch and snap". Slots `cell-{key}` (recebem `row`, `group`, `value`, `inline`) e `group-header`.
<script setup lang="ts">
import { VGroupedTable } from 'vueui-nova-kit'
</script>Uso
<VGroupedTable :columns="columns" :groups="groups" v-model:collapsed="collapsed">
<template #cell-name="{ row }">…</template>
</VGroupedTable>Playground
Os controles abaixo são gerados a partir das props declaradas em VGroupedTable.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. Redimensione o canvas para ver as colunas entrarem/saírem.
Ver código
<script setup lang="ts">
import { ref } from 'vue'
import { VGroupedTable, VGroupAvatar, VAvatar } from 'vueui-nova-kit'
const args = {
columns: [
{
key: 'name',
label: 'Deal'
},
{
key: 'amount',
label: 'Amount',
icon: {
width: 24,
height: 24,
body: '<g fill=\'none\' stroke=\'currentColor\' stroke-linecap=\'round\' stroke-linejoin=\'round\' stroke-width=\'2\'><path d=\'M2 5C2 3.343146 3.343146 2 5 2L11.171573 2C11.702006 2 12.210714 2.210714 12.585786 2.585786L21.414213 11.414213C22.195262 12.195262 22.195262 13.461592 21.414213 14.24264L14.24264 21.414213C13.461592 22.195262 12.195262 22.195262 11.414213 21.414213L2.585786 12.585786C2.210714 12.210714 2 11.702006 2 11.171573Z\'/><path fill=\'currentColor\' d=\'M9.5 8C9.5 8.8284 8.8284 9.5 8 9.5C7.1716 9.5 6.5 8.8284 6.5 8C6.5 7.1716 7.1716 6.5 8 6.5C8.8284 6.5 9.5 7.1716 9.5 8Z\' stroke=\'none\'/></g>'
},
iconOnlyHeader: true,
minWidth: 520,
collapseInto: 'name'
},
{
key: 'people',
label: 'People',
icon: {
width: 24,
height: 24,
body: '<path fill=\'none\' stroke=\'currentColor\' stroke-linecap=\'round\' stroke-linejoin=\'round\' stroke-width=\'2\' d=\'M8 14H10C13.3137 14 16 16.6863 16 20C16 20.5523 15.5523 21 15 21H3C2.44772 21 2 20.5523 2 20C2 16.6863 4.68629 14 8 14ZM9 4C10.6569 4 12 5.34315 12 7C12 8.65685 10.6569 10 9 10C7.34315 10 6 8.65685 6 7C6 5.34315 7.34315 4 9 4ZM16 4C17.6569 4 19 5.34315 19 7C19 8.65685 17.6569 10 16 10M18.3333 14.4713C20.554 15.409 22 17.589 22 20C22 20.5523 21.5523 21 21 21\'/>'
},
iconOnlyHeader: true,
minWidth: 520
},
{
key: 'date',
label: 'Close date',
icon: {
width: 24,
height: 24,
body: '<path fill=\'none\' stroke=\'currentColor\' stroke-linecap=\'round\' stroke-linejoin=\'round\' stroke-width=\'2\' d=\'M6 5H18C19.6569 5 21 6.34315 21 8V18C21 19.6569 19.6569 21 18 21H6C4.34315 21 3 19.6569 3 18V8C3 6.34315 4.34315 5 6 5ZM7 11H17M8 3V7M16 3V7\'/>'
},
iconOnlyHeader: true,
align: 'start'
},
{
key: 'owner',
label: 'Owner',
icon: {
width: 24,
height: 24,
body: '<path fill=\'none\' stroke=\'currentColor\' stroke-linecap=\'round\' stroke-linejoin=\'round\' stroke-width=\'2\' d=\'M11 14H13C16.3137 14 19 16.6863 19 20C19 20.5523 18.5523 21 18 21H6C5.44772 21 5 20.5523 5 20C5 16.6863 7.68629 14 11 14ZM12 4C13.6569 4 15 5.34315 15 7C15 8.65685 13.6569 10 12 10C10.3431 10 9 8.65685 9 7C9 5.34315 10.3431 4 12 4Z\'/>'
},
iconOnlyHeader: true,
align: 'end',
width: '48px'
}
],
groups: [
{
id: 'proposal',
label: 'Proposal',
icon: {
width: 24,
height: 24,
body: '<g fill=\'none\' stroke=\'currentColor\' stroke-linecap=\'round\' stroke-linejoin=\'round\' stroke-width=\'2\'><path d=\'M21.8769 10.4357C22.041 11.4721 22.041 12.5279 21.8769 13.5643M20.0902 17.8778C19.4734 18.7268 18.7268 19.4734 17.8778 20.0902M13.5643 21.8769C12.5279 22.041 11.4721 22.041 10.4357 21.8769M6.12215 20.0902C5.2732 19.4734 4.52663 18.7268 3.90983 17.8778M2.12312 13.5643C1.95896 12.5279 1.95896 11.4721 2.12312 10.4357M3.90983 6.12215C4.52663 5.2732 5.2732 4.52663 6.12215 3.90983M10.4357 2.12312C11.4721 1.95896 12.5279 1.95896 13.5643 2.12312M17.8778 3.90983C18.7268 4.52663 19.4734 5.2732 20.0902 6.12215\'/><path d=\'M12 6C15.3138 6 18 8.6862 18 12C18 15.3138 15.3138 18 12 18Z\'/></g>'
},
color: 'var(--v-color-success-base)',
rows: [
{
id: 'tideline',
name: 'Tideline',
color: '#2563eb',
amount: '$450',
date: '27 Aug',
owner: 'AM',
people: [
'SC',
'JC'
]
},
{
id: 'bramble',
name: 'Bramble',
color: '#ea580c',
amount: '$24k',
date: '15 Oct',
owner: 'LF',
people: [
'PP'
]
},
{
id: 'ashford',
name: 'Ashford',
color: '#dc2626',
amount: '$52k',
date: '29 Oct',
owner: 'JC',
people: [
'EW'
]
}
]
},
{
id: 'demo',
label: 'Demo',
icon: {
width: 24,
height: 24,
body: '<g fill=\'none\' stroke=\'currentColor\' stroke-linecap=\'round\' stroke-linejoin=\'round\' stroke-width=\'2\'><path d=\'M21.8769 10.4357C22.041 11.4721 22.041 12.5279 21.8769 13.5643M20.0902 17.8778C19.4734 18.7268 18.7268 19.4734 17.8778 20.0902M13.5643 21.8769C12.5279 22.041 11.4721 22.041 10.4357 21.8769M6.12215 20.0902C5.2732 19.4734 4.52663 18.7268 3.90983 17.8778M2.12312 13.5643C1.95896 12.5279 1.95896 11.4721 2.12312 10.4357M3.90983 6.12215C4.52663 5.2732 5.2732 4.52663 6.12215 3.90983M10.4357 2.12312C11.4721 1.95896 12.5279 1.95896 13.5643 2.12312M17.8778 3.90983C18.7268 4.52663 19.4734 5.2732 20.0902 6.12215\'/><path d=\'M12 6C15.3138 6 18 8.6862 18 12L12 12Z\'/></g>'
},
color: 'var(--v-color-success-base)',
rows: [
{
id: 'fielded',
name: 'Fielded',
color: '#111827',
amount: '$320',
date: '12 Sept',
owner: 'SC',
people: [
'AM',
'LF'
]
},
{
id: 'alvi',
name: 'alvi.sh',
color: '#7c3aed',
amount: '$10k',
date: '3 Sept',
owner: 'PP',
people: [
'JC'
]
},
{
id: 'vesper',
name: 'Vesper',
color: '#4338ca',
amount: '$18k',
date: '22 Oct',
owner: 'EW',
people: [
'SC'
]
}
]
},
{
id: 'leads',
label: 'Leads',
icon: {
width: 24,
height: 24,
body: '<path fill=\'none\' stroke=\'currentColor\' stroke-linecap=\'round\' stroke-linejoin=\'round\' stroke-width=\'2\' d=\'M21.8769 10.4357C22.041 11.4721 22.041 12.5279 21.8769 13.5643M20.0902 17.8778C19.4734 18.7268 18.7268 19.4734 17.8778 20.0902M13.5643 21.8769C12.5279 22.041 11.4721 22.041 10.4357 21.8769M6.12215 20.0902C5.2732 19.4734 4.52663 18.7268 3.90983 17.8778M2.12312 13.5643C1.95896 12.5279 1.95896 11.4721 2.12312 10.4357M3.90983 6.12215C4.52663 5.2732 5.2732 4.52663 6.12215 3.90983M10.4357 2.12312C11.4721 1.95896 12.5279 1.95896 13.5643 2.12312M17.8778 3.90983C18.7268 4.52663 19.4734 5.2732 20.0902 6.12215\'/>'
},
color: 'var(--v-color-success-base)',
rows: [
{
id: 'holloway',
name: 'Holloway',
color: '#ca8a04',
amount: '$180',
date: '27 Sept',
owner: 'AM',
people: [
'LF',
'PP',
'EW'
]
},
{
id: 'northlane',
name: 'Northlane',
color: '#16a34a',
amount: '$36k',
date: '5 Nov',
owner: 'JC',
people: [
'SC'
]
},
{
id: 'quietwork',
name: 'Quietwork',
color: '#111827',
amount: '$12k',
date: '12 Nov',
owner: 'LF',
people: []
}
]
},
{
id: 'won',
label: 'Closed Won',
icon: {
width: 24,
height: 24,
body: '<path fill=\'currentColor\' fill-rule=\'evenodd\' d=\'M12 1C18.0751 1 23 5.92487 23 12C23 18.0751 18.0751 23 12 23C5.92487 23 1 18.0751 1 12C1 5.92487 5.92487 1 12 1ZM17.1305 7.87822C16.6764 7.47461 15.9818 7.51547 15.5782 7.96953L10.5326 13.6436L8.42178 11.2695C8.01817 10.8155 7.32359 10.7746 6.86953 11.1782C6.41547 11.5818 6.37461 12.2764 6.77822 12.7305L9.71084 16.0305C9.91958 16.2653 10.2195 16.4 10.5337 16.4C10.8478 16.3999 11.1468 16.2652 11.3555 16.0305L17.2218 9.43047C17.6254 8.97641 17.5845 8.28183 17.1305 7.87822Z\' clip-rule=\'evenodd\'/>'
},
color: 'var(--v-color-success-base)',
rows: [
{
id: 'wovenpath',
name: 'Wovenpath',
color: '#111827',
amount: '$125',
date: '10 Aug',
owner: 'SC',
people: [
'AM'
]
},
{
id: 'halden',
name: 'Halden',
color: '#f97316',
amount: '$28k',
date: '21 Sept',
owner: 'PP',
people: [
'JC'
]
}
]
}
],
collapsible: true,
showHeader: 'auto',
headerMinWidth: 640,
size: 'default',
interactive: false,
ariaLabel: 'Deals'
}
const collapsed = ref([])
</script>
<template>
<VGroupedTable v-bind="args" v-model:collapsed="collapsed">
<template #cell-name="{ row }">
<span style="display:inline-flex;align-items:center;gap:8px;font-weight:500;">
<span :style="{ width: '14px', height: '14px', borderRadius: '4px', background: row.color }" />
{{ row.name }}
</span>
</template>
<template #cell-amount="{ row, inline }">
<span :style="{ fontVariantNumeric: 'tabular-nums', color: inline ? undefined : 'var(--v-color-text-muted)' }">{{ inline ? row.amount : 'USD ' + row.amount.replace('$', '') }}</span>
</template>
<template #cell-people="{ row }">
<VGroupAvatar v-if="row.people.length" size="xs" :max="3" :members="row.people.map((initials) => ({ initials }))" />
</template>
<template #cell-owner="{ row }">
<VAvatar size="xs" :initials="row.owner" decorative />
</template></VGroupedTable>
</template>Resizable Panel
Variação Painel redimensionável: arraste a borda direita do painel. Abaixo de 520px, Amount vira texto inline ao lado do nome e People some; abaixo de 640px o cabeçalho some.
Ver código
<script setup lang="ts">
import { ref } from 'vue'
import { VGroupedTable, VGroupAvatar, VAvatar } from 'vueui-nova-kit'
const args = {
columns: [
{
key: 'name',
label: 'Deal'
},
{
key: 'amount',
label: 'Amount',
icon: {
width: 24,
height: 24,
body: '<g fill=\'none\' stroke=\'currentColor\' stroke-linecap=\'round\' stroke-linejoin=\'round\' stroke-width=\'2\'><path d=\'M2 5C2 3.343146 3.343146 2 5 2L11.171573 2C11.702006 2 12.210714 2.210714 12.585786 2.585786L21.414213 11.414213C22.195262 12.195262 22.195262 13.461592 21.414213 14.24264L14.24264 21.414213C13.461592 22.195262 12.195262 22.195262 11.414213 21.414213L2.585786 12.585786C2.210714 12.210714 2 11.702006 2 11.171573Z\'/><path fill=\'currentColor\' d=\'M9.5 8C9.5 8.8284 8.8284 9.5 8 9.5C7.1716 9.5 6.5 8.8284 6.5 8C6.5 7.1716 7.1716 6.5 8 6.5C8.8284 6.5 9.5 7.1716 9.5 8Z\' stroke=\'none\'/></g>'
},
iconOnlyHeader: true,
minWidth: 520,
collapseInto: 'name'
},
{
key: 'people',
label: 'People',
icon: {
width: 24,
height: 24,
body: '<path fill=\'none\' stroke=\'currentColor\' stroke-linecap=\'round\' stroke-linejoin=\'round\' stroke-width=\'2\' d=\'M8 14H10C13.3137 14 16 16.6863 16 20C16 20.5523 15.5523 21 15 21H3C2.44772 21 2 20.5523 2 20C2 16.6863 4.68629 14 8 14ZM9 4C10.6569 4 12 5.34315 12 7C12 8.65685 10.6569 10 9 10C7.34315 10 6 8.65685 6 7C6 5.34315 7.34315 4 9 4ZM16 4C17.6569 4 19 5.34315 19 7C19 8.65685 17.6569 10 16 10M18.3333 14.4713C20.554 15.409 22 17.589 22 20C22 20.5523 21.5523 21 21 21\'/>'
},
iconOnlyHeader: true,
minWidth: 520
},
{
key: 'date',
label: 'Close date',
icon: {
width: 24,
height: 24,
body: '<path fill=\'none\' stroke=\'currentColor\' stroke-linecap=\'round\' stroke-linejoin=\'round\' stroke-width=\'2\' d=\'M6 5H18C19.6569 5 21 6.34315 21 8V18C21 19.6569 19.6569 21 18 21H6C4.34315 21 3 19.6569 3 18V8C3 6.34315 4.34315 5 6 5ZM7 11H17M8 3V7M16 3V7\'/>'
},
iconOnlyHeader: true,
align: 'start'
},
{
key: 'owner',
label: 'Owner',
icon: {
width: 24,
height: 24,
body: '<path fill=\'none\' stroke=\'currentColor\' stroke-linecap=\'round\' stroke-linejoin=\'round\' stroke-width=\'2\' d=\'M11 14H13C16.3137 14 19 16.6863 19 20C19 20.5523 18.5523 21 18 21H6C5.44772 21 5 20.5523 5 20C5 16.6863 7.68629 14 11 14ZM12 4C13.6569 4 15 5.34315 15 7C15 8.65685 13.6569 10 12 10C10.3431 10 9 8.65685 9 7C9 5.34315 10.3431 4 12 4Z\'/>'
},
iconOnlyHeader: true,
align: 'end',
width: '48px'
}
],
groups: [
{
id: 'proposal',
label: 'Proposal',
icon: {
width: 24,
height: 24,
body: '<g fill=\'none\' stroke=\'currentColor\' stroke-linecap=\'round\' stroke-linejoin=\'round\' stroke-width=\'2\'><path d=\'M21.8769 10.4357C22.041 11.4721 22.041 12.5279 21.8769 13.5643M20.0902 17.8778C19.4734 18.7268 18.7268 19.4734 17.8778 20.0902M13.5643 21.8769C12.5279 22.041 11.4721 22.041 10.4357 21.8769M6.12215 20.0902C5.2732 19.4734 4.52663 18.7268 3.90983 17.8778M2.12312 13.5643C1.95896 12.5279 1.95896 11.4721 2.12312 10.4357M3.90983 6.12215C4.52663 5.2732 5.2732 4.52663 6.12215 3.90983M10.4357 2.12312C11.4721 1.95896 12.5279 1.95896 13.5643 2.12312M17.8778 3.90983C18.7268 4.52663 19.4734 5.2732 20.0902 6.12215\'/><path d=\'M12 6C15.3138 6 18 8.6862 18 12C18 15.3138 15.3138 18 12 18Z\'/></g>'
},
color: 'var(--v-color-success-base)',
rows: [
{
id: 'tideline',
name: 'Tideline',
color: '#2563eb',
amount: '$450',
date: '27 Aug',
owner: 'AM',
people: [
'SC',
'JC'
]
},
{
id: 'bramble',
name: 'Bramble',
color: '#ea580c',
amount: '$24k',
date: '15 Oct',
owner: 'LF',
people: [
'PP'
]
},
{
id: 'ashford',
name: 'Ashford',
color: '#dc2626',
amount: '$52k',
date: '29 Oct',
owner: 'JC',
people: [
'EW'
]
}
]
},
{
id: 'demo',
label: 'Demo',
icon: {
width: 24,
height: 24,
body: '<g fill=\'none\' stroke=\'currentColor\' stroke-linecap=\'round\' stroke-linejoin=\'round\' stroke-width=\'2\'><path d=\'M21.8769 10.4357C22.041 11.4721 22.041 12.5279 21.8769 13.5643M20.0902 17.8778C19.4734 18.7268 18.7268 19.4734 17.8778 20.0902M13.5643 21.8769C12.5279 22.041 11.4721 22.041 10.4357 21.8769M6.12215 20.0902C5.2732 19.4734 4.52663 18.7268 3.90983 17.8778M2.12312 13.5643C1.95896 12.5279 1.95896 11.4721 2.12312 10.4357M3.90983 6.12215C4.52663 5.2732 5.2732 4.52663 6.12215 3.90983M10.4357 2.12312C11.4721 1.95896 12.5279 1.95896 13.5643 2.12312M17.8778 3.90983C18.7268 4.52663 19.4734 5.2732 20.0902 6.12215\'/><path d=\'M12 6C15.3138 6 18 8.6862 18 12L12 12Z\'/></g>'
},
color: 'var(--v-color-success-base)',
rows: [
{
id: 'fielded',
name: 'Fielded',
color: '#111827',
amount: '$320',
date: '12 Sept',
owner: 'SC',
people: [
'AM',
'LF'
]
},
{
id: 'alvi',
name: 'alvi.sh',
color: '#7c3aed',
amount: '$10k',
date: '3 Sept',
owner: 'PP',
people: [
'JC'
]
},
{
id: 'vesper',
name: 'Vesper',
color: '#4338ca',
amount: '$18k',
date: '22 Oct',
owner: 'EW',
people: [
'SC'
]
}
]
},
{
id: 'leads',
label: 'Leads',
icon: {
width: 24,
height: 24,
body: '<path fill=\'none\' stroke=\'currentColor\' stroke-linecap=\'round\' stroke-linejoin=\'round\' stroke-width=\'2\' d=\'M21.8769 10.4357C22.041 11.4721 22.041 12.5279 21.8769 13.5643M20.0902 17.8778C19.4734 18.7268 18.7268 19.4734 17.8778 20.0902M13.5643 21.8769C12.5279 22.041 11.4721 22.041 10.4357 21.8769M6.12215 20.0902C5.2732 19.4734 4.52663 18.7268 3.90983 17.8778M2.12312 13.5643C1.95896 12.5279 1.95896 11.4721 2.12312 10.4357M3.90983 6.12215C4.52663 5.2732 5.2732 4.52663 6.12215 3.90983M10.4357 2.12312C11.4721 1.95896 12.5279 1.95896 13.5643 2.12312M17.8778 3.90983C18.7268 4.52663 19.4734 5.2732 20.0902 6.12215\'/>'
},
color: 'var(--v-color-success-base)',
rows: [
{
id: 'holloway',
name: 'Holloway',
color: '#ca8a04',
amount: '$180',
date: '27 Sept',
owner: 'AM',
people: [
'LF',
'PP',
'EW'
]
},
{
id: 'northlane',
name: 'Northlane',
color: '#16a34a',
amount: '$36k',
date: '5 Nov',
owner: 'JC',
people: [
'SC'
]
},
{
id: 'quietwork',
name: 'Quietwork',
color: '#111827',
amount: '$12k',
date: '12 Nov',
owner: 'LF',
people: []
}
]
},
{
id: 'won',
label: 'Closed Won',
icon: {
width: 24,
height: 24,
body: '<path fill=\'currentColor\' fill-rule=\'evenodd\' d=\'M12 1C18.0751 1 23 5.92487 23 12C23 18.0751 18.0751 23 12 23C5.92487 23 1 18.0751 1 12C1 5.92487 5.92487 1 12 1ZM17.1305 7.87822C16.6764 7.47461 15.9818 7.51547 15.5782 7.96953L10.5326 13.6436L8.42178 11.2695C8.01817 10.8155 7.32359 10.7746 6.86953 11.1782C6.41547 11.5818 6.37461 12.2764 6.77822 12.7305L9.71084 16.0305C9.91958 16.2653 10.2195 16.4 10.5337 16.4C10.8478 16.3999 11.1468 16.2652 11.3555 16.0305L17.2218 9.43047C17.6254 8.97641 17.5845 8.28183 17.1305 7.87822Z\' clip-rule=\'evenodd\'/>'
},
color: 'var(--v-color-success-base)',
rows: [
{
id: 'wovenpath',
name: 'Wovenpath',
color: '#111827',
amount: '$125',
date: '10 Aug',
owner: 'SC',
people: [
'AM'
]
},
{
id: 'halden',
name: 'Halden',
color: '#f97316',
amount: '$28k',
date: '21 Sept',
owner: 'PP',
people: [
'JC'
]
}
]
}
],
collapsible: true,
showHeader: 'auto',
headerMinWidth: 640,
size: 'default',
interactive: false,
ariaLabel: 'Deals'
}
const collapsed = ref([])
</script>
<template>
<div style="resize:horizontal;overflow:auto;width:420px;min-width:300px;max-width:100%;padding:8px;border:1px solid var(--v-color-border);border-radius:16px;background:var(--v-color-surface);box-shadow:var(--v-shadow-md);">
<div style="display:flex;align-items:center;gap:8px;padding:6px 8px 10px;font:500 13px var(--v-font-family-sans);">Deals <span style="color:var(--v-color-text-muted)">11</span></div>
<VGroupedTable v-bind="args" size="compact" v-model:collapsed="collapsed">
<template #cell-name="{ row }">
<span style="display:inline-flex;align-items:center;gap:8px;font-weight:500;">
<span :style="{ width: '14px', height: '14px', borderRadius: '4px', background: row.color }" />
{{ row.name }}
</span>
</template>
<template #cell-amount="{ row, inline }">
<span :style="{ fontVariantNumeric: 'tabular-nums', color: inline ? undefined : 'var(--v-color-text-muted)' }">{{ inline ? row.amount : 'USD ' + row.amount.replace('$', '') }}</span>
</template>
<template #cell-people="{ row }">
<VGroupAvatar v-if="row.people.length" size="xs" :max="3" :members="row.people.map((initials) => ({ initials }))" />
</template>
<template #cell-owner="{ row }">
<VAvatar size="xs" :initials="row.owner" decorative />
</template></VGroupedTable>
</div>
</template>Collapsed
Variação Grupos recolhidos. Props: collapsed=["leads","won"].
Ver código
<script setup lang="ts">
import { ref } from 'vue'
import { VGroupedTable, VGroupAvatar, VAvatar } from 'vueui-nova-kit'
const args = {
columns: [
{
key: 'name',
label: 'Deal'
},
{
key: 'amount',
label: 'Amount',
icon: {
width: 24,
height: 24,
body: '<g fill=\'none\' stroke=\'currentColor\' stroke-linecap=\'round\' stroke-linejoin=\'round\' stroke-width=\'2\'><path d=\'M2 5C2 3.343146 3.343146 2 5 2L11.171573 2C11.702006 2 12.210714 2.210714 12.585786 2.585786L21.414213 11.414213C22.195262 12.195262 22.195262 13.461592 21.414213 14.24264L14.24264 21.414213C13.461592 22.195262 12.195262 22.195262 11.414213 21.414213L2.585786 12.585786C2.210714 12.210714 2 11.702006 2 11.171573Z\'/><path fill=\'currentColor\' d=\'M9.5 8C9.5 8.8284 8.8284 9.5 8 9.5C7.1716 9.5 6.5 8.8284 6.5 8C6.5 7.1716 7.1716 6.5 8 6.5C8.8284 6.5 9.5 7.1716 9.5 8Z\' stroke=\'none\'/></g>'
},
iconOnlyHeader: true,
minWidth: 520,
collapseInto: 'name'
},
{
key: 'people',
label: 'People',
icon: {
width: 24,
height: 24,
body: '<path fill=\'none\' stroke=\'currentColor\' stroke-linecap=\'round\' stroke-linejoin=\'round\' stroke-width=\'2\' d=\'M8 14H10C13.3137 14 16 16.6863 16 20C16 20.5523 15.5523 21 15 21H3C2.44772 21 2 20.5523 2 20C2 16.6863 4.68629 14 8 14ZM9 4C10.6569 4 12 5.34315 12 7C12 8.65685 10.6569 10 9 10C7.34315 10 6 8.65685 6 7C6 5.34315 7.34315 4 9 4ZM16 4C17.6569 4 19 5.34315 19 7C19 8.65685 17.6569 10 16 10M18.3333 14.4713C20.554 15.409 22 17.589 22 20C22 20.5523 21.5523 21 21 21\'/>'
},
iconOnlyHeader: true,
minWidth: 520
},
{
key: 'date',
label: 'Close date',
icon: {
width: 24,
height: 24,
body: '<path fill=\'none\' stroke=\'currentColor\' stroke-linecap=\'round\' stroke-linejoin=\'round\' stroke-width=\'2\' d=\'M6 5H18C19.6569 5 21 6.34315 21 8V18C21 19.6569 19.6569 21 18 21H6C4.34315 21 3 19.6569 3 18V8C3 6.34315 4.34315 5 6 5ZM7 11H17M8 3V7M16 3V7\'/>'
},
iconOnlyHeader: true,
align: 'start'
},
{
key: 'owner',
label: 'Owner',
icon: {
width: 24,
height: 24,
body: '<path fill=\'none\' stroke=\'currentColor\' stroke-linecap=\'round\' stroke-linejoin=\'round\' stroke-width=\'2\' d=\'M11 14H13C16.3137 14 19 16.6863 19 20C19 20.5523 18.5523 21 18 21H6C5.44772 21 5 20.5523 5 20C5 16.6863 7.68629 14 11 14ZM12 4C13.6569 4 15 5.34315 15 7C15 8.65685 13.6569 10 12 10C10.3431 10 9 8.65685 9 7C9 5.34315 10.3431 4 12 4Z\'/>'
},
iconOnlyHeader: true,
align: 'end',
width: '48px'
}
],
groups: [
{
id: 'proposal',
label: 'Proposal',
icon: {
width: 24,
height: 24,
body: '<g fill=\'none\' stroke=\'currentColor\' stroke-linecap=\'round\' stroke-linejoin=\'round\' stroke-width=\'2\'><path d=\'M21.8769 10.4357C22.041 11.4721 22.041 12.5279 21.8769 13.5643M20.0902 17.8778C19.4734 18.7268 18.7268 19.4734 17.8778 20.0902M13.5643 21.8769C12.5279 22.041 11.4721 22.041 10.4357 21.8769M6.12215 20.0902C5.2732 19.4734 4.52663 18.7268 3.90983 17.8778M2.12312 13.5643C1.95896 12.5279 1.95896 11.4721 2.12312 10.4357M3.90983 6.12215C4.52663 5.2732 5.2732 4.52663 6.12215 3.90983M10.4357 2.12312C11.4721 1.95896 12.5279 1.95896 13.5643 2.12312M17.8778 3.90983C18.7268 4.52663 19.4734 5.2732 20.0902 6.12215\'/><path d=\'M12 6C15.3138 6 18 8.6862 18 12C18 15.3138 15.3138 18 12 18Z\'/></g>'
},
color: 'var(--v-color-success-base)',
rows: [
{
id: 'tideline',
name: 'Tideline',
color: '#2563eb',
amount: '$450',
date: '27 Aug',
owner: 'AM',
people: [
'SC',
'JC'
]
},
{
id: 'bramble',
name: 'Bramble',
color: '#ea580c',
amount: '$24k',
date: '15 Oct',
owner: 'LF',
people: [
'PP'
]
},
{
id: 'ashford',
name: 'Ashford',
color: '#dc2626',
amount: '$52k',
date: '29 Oct',
owner: 'JC',
people: [
'EW'
]
}
]
},
{
id: 'demo',
label: 'Demo',
icon: {
width: 24,
height: 24,
body: '<g fill=\'none\' stroke=\'currentColor\' stroke-linecap=\'round\' stroke-linejoin=\'round\' stroke-width=\'2\'><path d=\'M21.8769 10.4357C22.041 11.4721 22.041 12.5279 21.8769 13.5643M20.0902 17.8778C19.4734 18.7268 18.7268 19.4734 17.8778 20.0902M13.5643 21.8769C12.5279 22.041 11.4721 22.041 10.4357 21.8769M6.12215 20.0902C5.2732 19.4734 4.52663 18.7268 3.90983 17.8778M2.12312 13.5643C1.95896 12.5279 1.95896 11.4721 2.12312 10.4357M3.90983 6.12215C4.52663 5.2732 5.2732 4.52663 6.12215 3.90983M10.4357 2.12312C11.4721 1.95896 12.5279 1.95896 13.5643 2.12312M17.8778 3.90983C18.7268 4.52663 19.4734 5.2732 20.0902 6.12215\'/><path d=\'M12 6C15.3138 6 18 8.6862 18 12L12 12Z\'/></g>'
},
color: 'var(--v-color-success-base)',
rows: [
{
id: 'fielded',
name: 'Fielded',
color: '#111827',
amount: '$320',
date: '12 Sept',
owner: 'SC',
people: [
'AM',
'LF'
]
},
{
id: 'alvi',
name: 'alvi.sh',
color: '#7c3aed',
amount: '$10k',
date: '3 Sept',
owner: 'PP',
people: [
'JC'
]
},
{
id: 'vesper',
name: 'Vesper',
color: '#4338ca',
amount: '$18k',
date: '22 Oct',
owner: 'EW',
people: [
'SC'
]
}
]
},
{
id: 'leads',
label: 'Leads',
icon: {
width: 24,
height: 24,
body: '<path fill=\'none\' stroke=\'currentColor\' stroke-linecap=\'round\' stroke-linejoin=\'round\' stroke-width=\'2\' d=\'M21.8769 10.4357C22.041 11.4721 22.041 12.5279 21.8769 13.5643M20.0902 17.8778C19.4734 18.7268 18.7268 19.4734 17.8778 20.0902M13.5643 21.8769C12.5279 22.041 11.4721 22.041 10.4357 21.8769M6.12215 20.0902C5.2732 19.4734 4.52663 18.7268 3.90983 17.8778M2.12312 13.5643C1.95896 12.5279 1.95896 11.4721 2.12312 10.4357M3.90983 6.12215C4.52663 5.2732 5.2732 4.52663 6.12215 3.90983M10.4357 2.12312C11.4721 1.95896 12.5279 1.95896 13.5643 2.12312M17.8778 3.90983C18.7268 4.52663 19.4734 5.2732 20.0902 6.12215\'/>'
},
color: 'var(--v-color-success-base)',
rows: [
{
id: 'holloway',
name: 'Holloway',
color: '#ca8a04',
amount: '$180',
date: '27 Sept',
owner: 'AM',
people: [
'LF',
'PP',
'EW'
]
},
{
id: 'northlane',
name: 'Northlane',
color: '#16a34a',
amount: '$36k',
date: '5 Nov',
owner: 'JC',
people: [
'SC'
]
},
{
id: 'quietwork',
name: 'Quietwork',
color: '#111827',
amount: '$12k',
date: '12 Nov',
owner: 'LF',
people: []
}
]
},
{
id: 'won',
label: 'Closed Won',
icon: {
width: 24,
height: 24,
body: '<path fill=\'currentColor\' fill-rule=\'evenodd\' d=\'M12 1C18.0751 1 23 5.92487 23 12C23 18.0751 18.0751 23 12 23C5.92487 23 1 18.0751 1 12C1 5.92487 5.92487 1 12 1ZM17.1305 7.87822C16.6764 7.47461 15.9818 7.51547 15.5782 7.96953L10.5326 13.6436L8.42178 11.2695C8.01817 10.8155 7.32359 10.7746 6.86953 11.1782C6.41547 11.5818 6.37461 12.2764 6.77822 12.7305L9.71084 16.0305C9.91958 16.2653 10.2195 16.4 10.5337 16.4C10.8478 16.3999 11.1468 16.2652 11.3555 16.0305L17.2218 9.43047C17.6254 8.97641 17.5845 8.28183 17.1305 7.87822Z\' clip-rule=\'evenodd\'/>'
},
color: 'var(--v-color-success-base)',
rows: [
{
id: 'wovenpath',
name: 'Wovenpath',
color: '#111827',
amount: '$125',
date: '10 Aug',
owner: 'SC',
people: [
'AM'
]
},
{
id: 'halden',
name: 'Halden',
color: '#f97316',
amount: '$28k',
date: '21 Sept',
owner: 'PP',
people: [
'JC'
]
}
]
}
],
collapsible: true,
showHeader: 'auto',
headerMinWidth: 640,
size: 'default',
interactive: false,
ariaLabel: 'Deals'
}
const collapsed = ref([
'leads',
'won'
])
</script>
<template>
<VGroupedTable v-bind="args" v-model:collapsed="collapsed">
<template #cell-name="{ row }">
<span style="display:inline-flex;align-items:center;gap:8px;font-weight:500;">
<span :style="{ width: '14px', height: '14px', borderRadius: '4px', background: row.color }" />
{{ row.name }}
</span>
</template>
<template #cell-amount="{ row, inline }">
<span :style="{ fontVariantNumeric: 'tabular-nums', color: inline ? undefined : 'var(--v-color-text-muted)' }">{{ inline ? row.amount : 'USD ' + row.amount.replace('$', '') }}</span>
</template>
<template #cell-people="{ row }">
<VGroupAvatar v-if="row.people.length" size="xs" :max="3" :members="row.people.map((initials) => ({ initials }))" />
</template>
<template #cell-owner="{ row }">
<VAvatar size="xs" :initials="row.owner" decorative />
</template></VGroupedTable>
</template>Forced Narrow
Variação Largura forçada (container-width="380"), útil para SSR.
Ver código
<script setup lang="ts">
import { ref } from 'vue'
import { VGroupedTable, VGroupAvatar, VAvatar } from 'vueui-nova-kit'
const args = {
columns: [
{
key: 'name',
label: 'Deal'
},
{
key: 'amount',
label: 'Amount',
icon: {
width: 24,
height: 24,
body: '<g fill=\'none\' stroke=\'currentColor\' stroke-linecap=\'round\' stroke-linejoin=\'round\' stroke-width=\'2\'><path d=\'M2 5C2 3.343146 3.343146 2 5 2L11.171573 2C11.702006 2 12.210714 2.210714 12.585786 2.585786L21.414213 11.414213C22.195262 12.195262 22.195262 13.461592 21.414213 14.24264L14.24264 21.414213C13.461592 22.195262 12.195262 22.195262 11.414213 21.414213L2.585786 12.585786C2.210714 12.210714 2 11.702006 2 11.171573Z\'/><path fill=\'currentColor\' d=\'M9.5 8C9.5 8.8284 8.8284 9.5 8 9.5C7.1716 9.5 6.5 8.8284 6.5 8C6.5 7.1716 7.1716 6.5 8 6.5C8.8284 6.5 9.5 7.1716 9.5 8Z\' stroke=\'none\'/></g>'
},
iconOnlyHeader: true,
minWidth: 520,
collapseInto: 'name'
},
{
key: 'people',
label: 'People',
icon: {
width: 24,
height: 24,
body: '<path fill=\'none\' stroke=\'currentColor\' stroke-linecap=\'round\' stroke-linejoin=\'round\' stroke-width=\'2\' d=\'M8 14H10C13.3137 14 16 16.6863 16 20C16 20.5523 15.5523 21 15 21H3C2.44772 21 2 20.5523 2 20C2 16.6863 4.68629 14 8 14ZM9 4C10.6569 4 12 5.34315 12 7C12 8.65685 10.6569 10 9 10C7.34315 10 6 8.65685 6 7C6 5.34315 7.34315 4 9 4ZM16 4C17.6569 4 19 5.34315 19 7C19 8.65685 17.6569 10 16 10M18.3333 14.4713C20.554 15.409 22 17.589 22 20C22 20.5523 21.5523 21 21 21\'/>'
},
iconOnlyHeader: true,
minWidth: 520
},
{
key: 'date',
label: 'Close date',
icon: {
width: 24,
height: 24,
body: '<path fill=\'none\' stroke=\'currentColor\' stroke-linecap=\'round\' stroke-linejoin=\'round\' stroke-width=\'2\' d=\'M6 5H18C19.6569 5 21 6.34315 21 8V18C21 19.6569 19.6569 21 18 21H6C4.34315 21 3 19.6569 3 18V8C3 6.34315 4.34315 5 6 5ZM7 11H17M8 3V7M16 3V7\'/>'
},
iconOnlyHeader: true,
align: 'start'
},
{
key: 'owner',
label: 'Owner',
icon: {
width: 24,
height: 24,
body: '<path fill=\'none\' stroke=\'currentColor\' stroke-linecap=\'round\' stroke-linejoin=\'round\' stroke-width=\'2\' d=\'M11 14H13C16.3137 14 19 16.6863 19 20C19 20.5523 18.5523 21 18 21H6C5.44772 21 5 20.5523 5 20C5 16.6863 7.68629 14 11 14ZM12 4C13.6569 4 15 5.34315 15 7C15 8.65685 13.6569 10 12 10C10.3431 10 9 8.65685 9 7C9 5.34315 10.3431 4 12 4Z\'/>'
},
iconOnlyHeader: true,
align: 'end',
width: '48px'
}
],
groups: [
{
id: 'proposal',
label: 'Proposal',
icon: {
width: 24,
height: 24,
body: '<g fill=\'none\' stroke=\'currentColor\' stroke-linecap=\'round\' stroke-linejoin=\'round\' stroke-width=\'2\'><path d=\'M21.8769 10.4357C22.041 11.4721 22.041 12.5279 21.8769 13.5643M20.0902 17.8778C19.4734 18.7268 18.7268 19.4734 17.8778 20.0902M13.5643 21.8769C12.5279 22.041 11.4721 22.041 10.4357 21.8769M6.12215 20.0902C5.2732 19.4734 4.52663 18.7268 3.90983 17.8778M2.12312 13.5643C1.95896 12.5279 1.95896 11.4721 2.12312 10.4357M3.90983 6.12215C4.52663 5.2732 5.2732 4.52663 6.12215 3.90983M10.4357 2.12312C11.4721 1.95896 12.5279 1.95896 13.5643 2.12312M17.8778 3.90983C18.7268 4.52663 19.4734 5.2732 20.0902 6.12215\'/><path d=\'M12 6C15.3138 6 18 8.6862 18 12C18 15.3138 15.3138 18 12 18Z\'/></g>'
},
color: 'var(--v-color-success-base)',
rows: [
{
id: 'tideline',
name: 'Tideline',
color: '#2563eb',
amount: '$450',
date: '27 Aug',
owner: 'AM',
people: [
'SC',
'JC'
]
},
{
id: 'bramble',
name: 'Bramble',
color: '#ea580c',
amount: '$24k',
date: '15 Oct',
owner: 'LF',
people: [
'PP'
]
},
{
id: 'ashford',
name: 'Ashford',
color: '#dc2626',
amount: '$52k',
date: '29 Oct',
owner: 'JC',
people: [
'EW'
]
}
]
},
{
id: 'demo',
label: 'Demo',
icon: {
width: 24,
height: 24,
body: '<g fill=\'none\' stroke=\'currentColor\' stroke-linecap=\'round\' stroke-linejoin=\'round\' stroke-width=\'2\'><path d=\'M21.8769 10.4357C22.041 11.4721 22.041 12.5279 21.8769 13.5643M20.0902 17.8778C19.4734 18.7268 18.7268 19.4734 17.8778 20.0902M13.5643 21.8769C12.5279 22.041 11.4721 22.041 10.4357 21.8769M6.12215 20.0902C5.2732 19.4734 4.52663 18.7268 3.90983 17.8778M2.12312 13.5643C1.95896 12.5279 1.95896 11.4721 2.12312 10.4357M3.90983 6.12215C4.52663 5.2732 5.2732 4.52663 6.12215 3.90983M10.4357 2.12312C11.4721 1.95896 12.5279 1.95896 13.5643 2.12312M17.8778 3.90983C18.7268 4.52663 19.4734 5.2732 20.0902 6.12215\'/><path d=\'M12 6C15.3138 6 18 8.6862 18 12L12 12Z\'/></g>'
},
color: 'var(--v-color-success-base)',
rows: [
{
id: 'fielded',
name: 'Fielded',
color: '#111827',
amount: '$320',
date: '12 Sept',
owner: 'SC',
people: [
'AM',
'LF'
]
},
{
id: 'alvi',
name: 'alvi.sh',
color: '#7c3aed',
amount: '$10k',
date: '3 Sept',
owner: 'PP',
people: [
'JC'
]
},
{
id: 'vesper',
name: 'Vesper',
color: '#4338ca',
amount: '$18k',
date: '22 Oct',
owner: 'EW',
people: [
'SC'
]
}
]
},
{
id: 'leads',
label: 'Leads',
icon: {
width: 24,
height: 24,
body: '<path fill=\'none\' stroke=\'currentColor\' stroke-linecap=\'round\' stroke-linejoin=\'round\' stroke-width=\'2\' d=\'M21.8769 10.4357C22.041 11.4721 22.041 12.5279 21.8769 13.5643M20.0902 17.8778C19.4734 18.7268 18.7268 19.4734 17.8778 20.0902M13.5643 21.8769C12.5279 22.041 11.4721 22.041 10.4357 21.8769M6.12215 20.0902C5.2732 19.4734 4.52663 18.7268 3.90983 17.8778M2.12312 13.5643C1.95896 12.5279 1.95896 11.4721 2.12312 10.4357M3.90983 6.12215C4.52663 5.2732 5.2732 4.52663 6.12215 3.90983M10.4357 2.12312C11.4721 1.95896 12.5279 1.95896 13.5643 2.12312M17.8778 3.90983C18.7268 4.52663 19.4734 5.2732 20.0902 6.12215\'/>'
},
color: 'var(--v-color-success-base)',
rows: [
{
id: 'holloway',
name: 'Holloway',
color: '#ca8a04',
amount: '$180',
date: '27 Sept',
owner: 'AM',
people: [
'LF',
'PP',
'EW'
]
},
{
id: 'northlane',
name: 'Northlane',
color: '#16a34a',
amount: '$36k',
date: '5 Nov',
owner: 'JC',
people: [
'SC'
]
},
{
id: 'quietwork',
name: 'Quietwork',
color: '#111827',
amount: '$12k',
date: '12 Nov',
owner: 'LF',
people: []
}
]
},
{
id: 'won',
label: 'Closed Won',
icon: {
width: 24,
height: 24,
body: '<path fill=\'currentColor\' fill-rule=\'evenodd\' d=\'M12 1C18.0751 1 23 5.92487 23 12C23 18.0751 18.0751 23 12 23C5.92487 23 1 18.0751 1 12C1 5.92487 5.92487 1 12 1ZM17.1305 7.87822C16.6764 7.47461 15.9818 7.51547 15.5782 7.96953L10.5326 13.6436L8.42178 11.2695C8.01817 10.8155 7.32359 10.7746 6.86953 11.1782C6.41547 11.5818 6.37461 12.2764 6.77822 12.7305L9.71084 16.0305C9.91958 16.2653 10.2195 16.4 10.5337 16.4C10.8478 16.3999 11.1468 16.2652 11.3555 16.0305L17.2218 9.43047C17.6254 8.97641 17.5845 8.28183 17.1305 7.87822Z\' clip-rule=\'evenodd\'/>'
},
color: 'var(--v-color-success-base)',
rows: [
{
id: 'wovenpath',
name: 'Wovenpath',
color: '#111827',
amount: '$125',
date: '10 Aug',
owner: 'SC',
people: [
'AM'
]
},
{
id: 'halden',
name: 'Halden',
color: '#f97316',
amount: '$28k',
date: '21 Sept',
owner: 'PP',
people: [
'JC'
]
}
]
}
],
collapsible: true,
showHeader: 'auto',
headerMinWidth: 640,
size: 'default',
interactive: false,
ariaLabel: 'Deals',
containerWidth: 380
}
const collapsed = ref([])
</script>
<template>
<VGroupedTable v-bind="args" v-model:collapsed="collapsed">
<template #cell-name="{ row }">
<span style="display:inline-flex;align-items:center;gap:8px;font-weight:500;">
<span :style="{ width: '14px', height: '14px', borderRadius: '4px', background: row.color }" />
{{ row.name }}
</span>
</template>
<template #cell-amount="{ row, inline }">
<span :style="{ fontVariantNumeric: 'tabular-nums', color: inline ? undefined : 'var(--v-color-text-muted)' }">{{ inline ? row.amount : 'USD ' + row.amount.replace('$', '') }}</span>
</template>
<template #cell-people="{ row }">
<VGroupAvatar v-if="row.people.length" size="xs" :max="3" :members="row.people.map((initials) => ({ initials }))" />
</template>
<template #cell-owner="{ row }">
<VAvatar size="xs" :initials="row.owner" decorative />
</template></VGroupedTable>
</template>Props
| Prop | Tipo | Default | Descrição |
|---|---|---|---|
columns | VGroupedTableColumn[] | — | — |
groups | VGroupedTableGroup[] | — | — |
collapsed | string[] | — | Collapsed group ids (`v-model:collapsed`). |
collapsible | boolean | true | — |
showHeader | boolean | 'auto' | "auto" | Column header row. `auto` shows it once at least `headerMinWidth` px are available. |
headerMinWidth | number | 640 | — |
size | VGroupedTableSize | "default" | — |
interactive | boolean | false | Rows become focusable and emit `row-click`. |
containerWidth | number | undefined | Forces the measured width (SSR/tests). Normally measured with ResizeObserver. |
ariaLabel | string | — | — |
dataTestId | string | — | — |
Events
| Evento | Payload | Descrição |
|---|---|---|
@update:collapsed | value: string[] | — |
@group-toggle | groupId: string, collapsed: boolean | — |
@row-click | row: VGroupedTableRow, group: VGroupedTableGroup | — |
Slots
| Slot | Props do slot |
|---|---|
#group-header | group |
#[`cell-${column.key}`] | rowgroupvalue |
#[`cell-${inline.key}`] | rowgroupvalueinline |
Fonte: src/components/data/VGroupedTable/VGroupedTable.vue · tipos: src/components/data/VGroupedTable/VGroupedTable.types.ts