Dados e tabelas

VTable

Componente12 exemplos19 propsA2UI · Table

Exibição de dados estruturados para ver, entender e operar: suporta sorting, seleção, inline actions e progressive disclosure num design limpo, consistente e flexível. (Tab) título "Table — Structured data display", subtítulo "Turn rows into insight.

Importação
<script setup lang="ts">
import { VTable } from 'vueui-nova-kit'
</script>

Uso

Exemplo
<script setup lang="ts">
import { VTable } from 'vueui-nova-kit'
</script>

<template>
  <VTable selectable multiple />
</template>

Playground

Os controles abaixo são gerados a partir das props declaradas em VTable.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
vue
<script setup lang="ts">
import { VTable } from 'vueui-nova-kit'

const columns = [
  { key: 'name', label: 'Name', sortable: true },
  { key: 'role', label: 'Role', sortable: true },
  { key: 'status', label: 'Status' },
  { key: 'lastActive', label: 'Last Active' },
]
const rows = [
  {
    id: 1,
    name: 'Alex Carter',
    role: 'Product Designer',
    status: 'active',
    lastActive: '2 hours ago',
    avatar: 'https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?w=80&h=80&fit=crop',
  },
  {
    id: 2,
    name: 'Priya Shah',
    role: 'Frontend Engineer',
    status: 'in-review',
    lastActive: '1 day ago',
    avatar: 'https://images.unsplash.com/photo-1494790108377-be9c29b29330?w=80&h=80&fit=crop',
  },
  {
    id: 3,
    name: 'Marcus Lee',
    role: 'Product Manager',
    status: 'active',
    lastActive: '5 hours ago',
    avatar: 'https://images.unsplash.com/photo-1472099645785-5658abf4ff4e?w=80&h=80&fit=crop',
  },
  {
    id: 4,
    name: 'Elena Garcia',
    role: 'UX Researcher',
    status: 'away',
    lastActive: '2 days ago',
    avatar: 'https://images.unsplash.com/photo-1438761681033-6461ffad8d80?w=80&h=80&fit=crop',
  },
  {
    id: 5,
    name: 'Daniel Kim',
    role: 'DevOps Engineer',
    status: 'inactive',
    lastActive: '1 week ago',
    disabledActions: true,
  },
  {
    id: 6,
    name: 'Sophia Chen',
    role: 'Data Analyst',
    status: 'active',
    lastActive: '3 hours ago',
    expandedContent: 'Expanded details for Sophia Chen.',
  },
]
</script>

<template>
  <VTable :columns="columns" :rows="rows" />
</template>

Hero

Variação Hero.

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

const columns = [
  { key: 'name', label: 'Name', sortable: true },
  { key: 'role', label: 'Role', sortable: true },
  { key: 'status', label: 'Status' },
  { key: 'lastActive', label: 'Last Active' },
]
const rows = [
  {
    id: 1,
    name: 'Alex Carter',
    role: 'Product Designer',
    status: 'active',
    lastActive: '2 hours ago',
    avatar: 'https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?w=80&h=80&fit=crop',
  },
  {
    id: 2,
    name: 'Priya Shah',
    role: 'Frontend Engineer',
    status: 'in-review',
    lastActive: '1 day ago',
    avatar: 'https://images.unsplash.com/photo-1494790108377-be9c29b29330?w=80&h=80&fit=crop',
  },
  {
    id: 3,
    name: 'Marcus Lee',
    role: 'Product Manager',
    status: 'active',
    lastActive: '5 hours ago',
    avatar: 'https://images.unsplash.com/photo-1472099645785-5658abf4ff4e?w=80&h=80&fit=crop',
  },
  {
    id: 4,
    name: 'Elena Garcia',
    role: 'UX Researcher',
    status: 'away',
    lastActive: '2 days ago',
    avatar: 'https://images.unsplash.com/photo-1438761681033-6461ffad8d80?w=80&h=80&fit=crop',
  },
  {
    id: 5,
    name: 'Daniel Kim',
    role: 'DevOps Engineer',
    status: 'inactive',
    lastActive: '1 week ago',
    disabledActions: true,
  },
  {
    id: 6,
    name: 'Sophia Chen',
    role: 'Data Analyst',
    status: 'active',
    lastActive: '3 hours ago',
    expandedContent: 'Expanded details for Sophia Chen.',
  },
]
</script>

<template>
  <VTable :columns="columns" :rows="rows" />
</template>

Variants

Variação Variantes.

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

const columns = [
  {
    key: 'name',
    label: 'Name',
    sortable: true
  },
  {
    key: 'role',
    label: 'Role',
    sortable: true
  },
  {
    key: 'status',
    label: 'Status'
  },
  {
    key: 'lastActive',
    label: 'Last Active'
  }
]
const rows = [
  {
    id: 1,
    name: 'Alex Carter',
    role: 'Product Designer',
    status: 'active',
    lastActive: '2 hours ago',
    avatar: 'https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?w=80&h=80&fit=crop'
  },
  {
    id: 2,
    name: 'Priya Shah',
    role: 'Frontend Engineer',
    status: 'in-review',
    lastActive: '1 day ago',
    avatar: 'https://images.unsplash.com/photo-1494790108377-be9c29b29330?w=80&h=80&fit=crop'
  },
  {
    id: 3,
    name: 'Marcus Lee',
    role: 'Product Manager',
    status: 'active',
    lastActive: '5 hours ago',
    avatar: 'https://images.unsplash.com/photo-1472099645785-5658abf4ff4e?w=80&h=80&fit=crop'
  },
  {
    id: 4,
    name: 'Elena Garcia',
    role: 'UX Researcher',
    status: 'away',
    lastActive: '2 days ago',
    avatar: 'https://images.unsplash.com/photo-1438761681033-6461ffad8d80?w=80&h=80&fit=crop'
  },
  {
    id: 5,
    name: 'Daniel Kim',
    role: 'DevOps Engineer',
    status: 'inactive',
    lastActive: '1 week ago',
    disabledActions: true
  },
  {
    id: 6,
    name: 'Sophia Chen',
    role: 'Data Analyst',
    status: 'active',
    lastActive: '3 hours ago',
    expandedContent: 'Expanded details for Sophia Chen.'
  }
]
</script>

<template>
  <div style="display:grid;gap:24px">
    <VTable :columns="columns" :rows="rows" variant="default" />
    <VTable :columns="columns" :rows="rows" variant="bordered" />
    <VTable :columns="columns" :rows="rows" variant="striped" />
    <VTable :columns="columns" :rows="rows" variant="minimal" />
  </div>
</template>

Sizes

Variação Tamanhos.

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

const columns = [
  {
    key: 'name',
    label: 'Name',
    sortable: true
  },
  {
    key: 'role',
    label: 'Role',
    sortable: true
  },
  {
    key: 'status',
    label: 'Status'
  },
  {
    key: 'lastActive',
    label: 'Last Active'
  }
]
const rows = [
  {
    id: 1,
    name: 'Alex Carter',
    role: 'Product Designer',
    status: 'active',
    lastActive: '2 hours ago',
    avatar: 'https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?w=80&h=80&fit=crop'
  },
  {
    id: 2,
    name: 'Priya Shah',
    role: 'Frontend Engineer',
    status: 'in-review',
    lastActive: '1 day ago',
    avatar: 'https://images.unsplash.com/photo-1494790108377-be9c29b29330?w=80&h=80&fit=crop'
  },
  {
    id: 3,
    name: 'Marcus Lee',
    role: 'Product Manager',
    status: 'active',
    lastActive: '5 hours ago',
    avatar: 'https://images.unsplash.com/photo-1472099645785-5658abf4ff4e?w=80&h=80&fit=crop'
  },
  {
    id: 4,
    name: 'Elena Garcia',
    role: 'UX Researcher',
    status: 'away',
    lastActive: '2 days ago',
    avatar: 'https://images.unsplash.com/photo-1438761681033-6461ffad8d80?w=80&h=80&fit=crop'
  },
  {
    id: 5,
    name: 'Daniel Kim',
    role: 'DevOps Engineer',
    status: 'inactive',
    lastActive: '1 week ago',
    disabledActions: true
  },
  {
    id: 6,
    name: 'Sophia Chen',
    role: 'Data Analyst',
    status: 'active',
    lastActive: '3 hours ago',
    expandedContent: 'Expanded details for Sophia Chen.'
  }
]
</script>

<template>
  <div style="display:grid;gap:24px">
    <VTable :columns="columns" :rows="rows" size="compact" />
    <VTable :columns="columns" :rows="rows" size="default" />
    <VTable :columns="columns" :rows="rows" size="comfortable" />
  </div>
</template>

States

Variação Estados.

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

const columns = [
  {
    key: 'name',
    label: 'Name',
    sortable: true
  },
  {
    key: 'role',
    label: 'Role',
    sortable: true
  },
  {
    key: 'status',
    label: 'Status'
  },
  {
    key: 'lastActive',
    label: 'Last Active'
  }
]
const rows = [
  {
    id: 1,
    name: 'Alex Carter',
    role: 'Product Designer',
    status: 'active',
    lastActive: '2 hours ago',
    avatar: 'https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?w=80&h=80&fit=crop'
  },
  {
    id: 2,
    name: 'Priya Shah',
    role: 'Frontend Engineer',
    status: 'in-review',
    lastActive: '1 day ago',
    avatar: 'https://images.unsplash.com/photo-1494790108377-be9c29b29330?w=80&h=80&fit=crop'
  },
  {
    id: 3,
    name: 'Marcus Lee',
    role: 'Product Manager',
    status: 'active',
    lastActive: '5 hours ago',
    avatar: 'https://images.unsplash.com/photo-1472099645785-5658abf4ff4e?w=80&h=80&fit=crop'
  },
  {
    id: 4,
    name: 'Elena Garcia',
    role: 'UX Researcher',
    status: 'away',
    lastActive: '2 days ago',
    avatar: 'https://images.unsplash.com/photo-1438761681033-6461ffad8d80?w=80&h=80&fit=crop'
  },
  {
    id: 5,
    name: 'Daniel Kim',
    role: 'DevOps Engineer',
    status: 'inactive',
    lastActive: '1 week ago',
    disabledActions: true
  },
  {
    id: 6,
    name: 'Sophia Chen',
    role: 'Data Analyst',
    status: 'active',
    lastActive: '3 hours ago',
    expandedContent: 'Expanded details for Sophia Chen.'
  }
]
</script>

<template>
  <div style="display:grid;gap:24px">
    <VTable :columns="columns" :rows="rows" :selected="[4]" />
    <VTable :columns="columns" :rows="rows" loading />
    <VTable :columns="columns" :rows="[]" />
  </div>
</template>

Comparison

Variação Comparison. Props: variant="comparison", selectable=false, showToolbar=false.

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

const columns = [
  { key: 'field', label: 'Context field' },
  { key: 'sent', label: 'Sent by router', cell: 'mark' },
  {
    key: 'expected',
    label: 'Expected by billing',
    cell: 'mark',
  },
  { key: 'status', label: 'Status', cell: 'status' },
]
const rows = [
  {
    id: 'customer_id',
    field: 'customer_id',
    tone: 'match',
    sent: { ok: true, label: 'present' },
    expected: { ok: true, label: 'required' },
    status: 'match',
  },
  {
    id: 'intent',
    field: 'intent',
    tone: 'match',
    sent: { ok: true, label: 'present' },
    expected: { ok: true, label: 'required' },
    status: 'match',
  },
  {
    id: 'order_id',
    field: 'order_id',
    tone: 'match',
    sent: { ok: true, label: 'present' },
    expected: { ok: true, label: 'required' },
    status: 'match',
  },
  {
    id: 'scope',
    field: 'authorization_scope',
    tone: 'match',
    sent: { ok: true, label: 'present' },
    expected: { ok: true, label: 'required' },
    status: 'match',
  },
  {
    id: 'history',
    field: 'conversation_history',
    tone: 'match',
    sent: { ok: true, label: 'present' },
    expected: { ok: true, label: 'optional' },
    status: 'match',
  },
  {
    id: 'session',
    field: 'session_metadata',
    tone: 'neutral',
    sent: { ok: true, label: 'present' },
    expected: { ok: false, label: 'not used' },
    status: 'unused',
  },
]
</script>

<template>
  <VTable
    :columns="columns"
    :rows="rows"
    :selectable="false"
    variant="comparison"
    :show-toolbar="false" />
</template>

Sorting

Variação Sorting.

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

const args = {
  columns: [
    {
      key: 'name',
      label: 'Name',
      sortable: true
    },
    {
      key: 'role',
      label: 'Role',
      sortable: true
    },
    {
      key: 'status',
      label: 'Status'
    },
    {
      key: 'lastActive',
      label: 'Last Active'
    }
  ],
  rows: [
    {
      id: 1,
      name: 'Alex Carter',
      role: 'Product Designer',
      status: 'active',
      lastActive: '2 hours ago',
      avatar: 'https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?w=80&h=80&fit=crop'
    },
    {
      id: 2,
      name: 'Priya Shah',
      role: 'Frontend Engineer',
      status: 'in-review',
      lastActive: '1 day ago',
      avatar: 'https://images.unsplash.com/photo-1494790108377-be9c29b29330?w=80&h=80&fit=crop'
    },
    {
      id: 3,
      name: 'Marcus Lee',
      role: 'Product Manager',
      status: 'active',
      lastActive: '5 hours ago',
      avatar: 'https://images.unsplash.com/photo-1472099645785-5658abf4ff4e?w=80&h=80&fit=crop'
    },
    {
      id: 4,
      name: 'Elena Garcia',
      role: 'UX Researcher',
      status: 'away',
      lastActive: '2 days ago',
      avatar: 'https://images.unsplash.com/photo-1438761681033-6461ffad8d80?w=80&h=80&fit=crop'
    },
    {
      id: 5,
      name: 'Daniel Kim',
      role: 'DevOps Engineer',
      status: 'inactive',
      lastActive: '1 week ago',
      disabledActions: true
    },
    {
      id: 6,
      name: 'Sophia Chen',
      role: 'Data Analyst',
      status: 'active',
      lastActive: '3 hours ago',
      expandedContent: 'Expanded details for Sophia Chen.'
    }
  ],
  selectable: true,
  multiple: true,
  sort: [
    {
      key: 'name',
      direction: 'desc',
      priority: 1
    }
  ]
}
const columns = [
  {
    key: 'name',
    label: 'Name',
    sortable: true
  },
  {
    key: 'role',
    label: 'Role',
    sortable: true
  },
  {
    key: 'status',
    label: 'Status'
  },
  {
    key: 'lastActive',
    label: 'Last Active'
  }
]
const rows = [
  {
    id: 1,
    name: 'Alex Carter',
    role: 'Product Designer',
    status: 'active',
    lastActive: '2 hours ago',
    avatar: 'https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?w=80&h=80&fit=crop'
  },
  {
    id: 2,
    name: 'Priya Shah',
    role: 'Frontend Engineer',
    status: 'in-review',
    lastActive: '1 day ago',
    avatar: 'https://images.unsplash.com/photo-1494790108377-be9c29b29330?w=80&h=80&fit=crop'
  },
  {
    id: 3,
    name: 'Marcus Lee',
    role: 'Product Manager',
    status: 'active',
    lastActive: '5 hours ago',
    avatar: 'https://images.unsplash.com/photo-1472099645785-5658abf4ff4e?w=80&h=80&fit=crop'
  },
  {
    id: 4,
    name: 'Elena Garcia',
    role: 'UX Researcher',
    status: 'away',
    lastActive: '2 days ago',
    avatar: 'https://images.unsplash.com/photo-1438761681033-6461ffad8d80?w=80&h=80&fit=crop'
  },
  {
    id: 5,
    name: 'Daniel Kim',
    role: 'DevOps Engineer',
    status: 'inactive',
    lastActive: '1 week ago',
    disabledActions: true
  },
  {
    id: 6,
    name: 'Sophia Chen',
    role: 'Data Analyst',
    status: 'active',
    lastActive: '3 hours ago',
    expandedContent: 'Expanded details for Sophia Chen.'
  }
]
</script>

<template>
  <VTable v-bind="args" :columns="columns" :rows="rows" />
</template>

Custom Cells

Variação Personalizado células. Props: selectable=false, showToolbar=false. Slots usados: #header-weight, #cell-name, #cell-weight, #cell-pl.

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

const args = {
  columns: [
    {
      key: 'name',
      label: 'Holding'
    },
    {
      key: 'weight',
      label: 'Weight'
    },
    {
      key: 'pl',
      label: 'P/L'
    }
  ],
  rows: [
    {
      id: 1,
      name: 'Alex Carter',
      weight: 42,
      pl: 12.4
    },
    {
      id: 2,
      name: 'Priya Shah',
      weight: 27,
      pl: -3.1
    },
    {
      id: 3,
      name: 'Marcus Lee',
      weight: 18,
      pl: 5.8
    },
    {
      id: 4,
      name: 'Sofia Reyes',
      weight: 13,
      pl: -0.6
    }
  ],
  selectable: false,
  multiple: true,
  showToolbar: false
}
</script>

<template>
  <VTable v-bind="args">
    <template #header-weight="{ column }"><span style="font-weight:600">{{ column.label }} (%)</span></template>
    <template #cell-name="{ row }">
      <span style="display:inline-flex;align-items:center;gap:var(--v-space-2)">
        <VAvatar :alt="row.name" size="sm" decorative />
        <strong>{{ row.name }}</strong>
      </span>
    </template>
    <template #cell-weight="{ value }">
      <span style="display:flex;align-items:center;gap:var(--v-space-2);min-width:140px">
        <span style="flex:1;height:6px;border-radius:999px;background:var(--v-color-neutral-100);overflow:hidden">
          <span :style="{ display:'block', height:'100%', width: value + '%', background:'var(--v-color-primary-500)' }" />
        </span>
        <span>{{ value }}%</span>
      </span>
    </template>
    <template #cell-pl="{ value }">
      <VBadge :variant="value >= 0 ? 'success' : 'danger'">{{ value >= 0 ? '+' : '' }}{{ value }}%</VBadge>
    </template>
  </VTable>
</template>

Loading

Variação Carregando. Props: loading=true.

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

const columns = [
  { key: 'name', label: 'Name', sortable: true },
  { key: 'role', label: 'Role', sortable: true },
  { key: 'status', label: 'Status' },
  { key: 'lastActive', label: 'Last Active' },
]
const rows = [
  {
    id: 1,
    name: 'Alex Carter',
    role: 'Product Designer',
    status: 'active',
    lastActive: '2 hours ago',
    avatar: 'https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?w=80&h=80&fit=crop',
  },
  {
    id: 2,
    name: 'Priya Shah',
    role: 'Frontend Engineer',
    status: 'in-review',
    lastActive: '1 day ago',
    avatar: 'https://images.unsplash.com/photo-1494790108377-be9c29b29330?w=80&h=80&fit=crop',
  },
  {
    id: 3,
    name: 'Marcus Lee',
    role: 'Product Manager',
    status: 'active',
    lastActive: '5 hours ago',
    avatar: 'https://images.unsplash.com/photo-1472099645785-5658abf4ff4e?w=80&h=80&fit=crop',
  },
  {
    id: 4,
    name: 'Elena Garcia',
    role: 'UX Researcher',
    status: 'away',
    lastActive: '2 days ago',
    avatar: 'https://images.unsplash.com/photo-1438761681033-6461ffad8d80?w=80&h=80&fit=crop',
  },
  {
    id: 5,
    name: 'Daniel Kim',
    role: 'DevOps Engineer',
    status: 'inactive',
    lastActive: '1 week ago',
    disabledActions: true,
  },
  {
    id: 6,
    name: 'Sophia Chen',
    role: 'Data Analyst',
    status: 'active',
    lastActive: '3 hours ago',
    expandedContent: 'Expanded details for Sophia Chen.',
  },
]
</script>

<template>
  <VTable :columns="columns" :rows="rows" loading />
</template>

Search And Pagination

Variação Busca e Pagination. Props: showPagination=true, page=1, pageSize=5, total=5, search="a".

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

const columns = [
  { key: 'name', label: 'Name', sortable: true },
  { key: 'role', label: 'Role', sortable: true },
  { key: 'status', label: 'Status' },
  { key: 'lastActive', label: 'Last Active' },
]
const rows = [
  {
    id: 1,
    name: 'Alex Carter',
    role: 'Product Designer',
    status: 'active',
    lastActive: '2 hours ago',
    avatar: 'https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?w=80&h=80&fit=crop',
  },
  {
    id: 2,
    name: 'Priya Shah',
    role: 'Frontend Engineer',
    status: 'in-review',
    lastActive: '1 day ago',
    avatar: 'https://images.unsplash.com/photo-1494790108377-be9c29b29330?w=80&h=80&fit=crop',
  },
  {
    id: 3,
    name: 'Marcus Lee',
    role: 'Product Manager',
    status: 'active',
    lastActive: '5 hours ago',
    avatar: 'https://images.unsplash.com/photo-1472099645785-5658abf4ff4e?w=80&h=80&fit=crop',
  },
  {
    id: 4,
    name: 'Elena Garcia',
    role: 'UX Researcher',
    status: 'away',
    lastActive: '2 days ago',
    avatar: 'https://images.unsplash.com/photo-1438761681033-6461ffad8d80?w=80&h=80&fit=crop',
  },
  {
    id: 5,
    name: 'Daniel Kim',
    role: 'DevOps Engineer',
    status: 'inactive',
    lastActive: '1 week ago',
    disabledActions: true,
  },
  {
    id: 6,
    name: 'Sophia Chen',
    role: 'Data Analyst',
    status: 'active',
    lastActive: '3 hours ago',
    expandedContent: 'Expanded details for Sophia Chen.',
  },
]
</script>

<template>
  <VTable
    :columns="columns"
    :rows="rows"
    :page-size="5"
    :total="5"
    search="a" />
</template>

No Row Actions

Variação Sem Row ações. Props: showActions=false.

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

const columns = [
  { key: 'name', label: 'Name', sortable: true },
  { key: 'role', label: 'Role', sortable: true },
  { key: 'status', label: 'Status' },
  { key: 'lastActive', label: 'Last Active' },
]
const rows = [
  {
    id: 1,
    name: 'Alex Carter',
    role: 'Product Designer',
    status: 'active',
    lastActive: '2 hours ago',
    avatar: 'https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?w=80&h=80&fit=crop',
  },
  {
    id: 2,
    name: 'Priya Shah',
    role: 'Frontend Engineer',
    status: 'in-review',
    lastActive: '1 day ago',
    avatar: 'https://images.unsplash.com/photo-1494790108377-be9c29b29330?w=80&h=80&fit=crop',
  },
  {
    id: 3,
    name: 'Marcus Lee',
    role: 'Product Manager',
    status: 'active',
    lastActive: '5 hours ago',
    avatar: 'https://images.unsplash.com/photo-1472099645785-5658abf4ff4e?w=80&h=80&fit=crop',
  },
  {
    id: 4,
    name: 'Elena Garcia',
    role: 'UX Researcher',
    status: 'away',
    lastActive: '2 days ago',
    avatar: 'https://images.unsplash.com/photo-1438761681033-6461ffad8d80?w=80&h=80&fit=crop',
  },
  {
    id: 5,
    name: 'Daniel Kim',
    role: 'DevOps Engineer',
    status: 'inactive',
    lastActive: '1 week ago',
    disabledActions: true,
  },
  {
    id: 6,
    name: 'Sophia Chen',
    role: 'Data Analyst',
    status: 'active',
    lastActive: '3 hours ago',
    expandedContent: 'Expanded details for Sophia Chen.',
  },
]
</script>

<template>
  <VTable :columns="columns" :rows="rows" :show-actions="false" />
</template>

Controlled Selection Sort Search

Estado controlado: v-model:selected, v-model:sort, v-model:search e v-model:page ligados a refs; o estado atual é exibido abaixo da tabela.

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

const args = {
  columns: [
    {
      key: 'name',
      label: 'Name',
      sortable: true
    },
    {
      key: 'role',
      label: 'Role',
      sortable: true
    },
    {
      key: 'status',
      label: 'Status'
    },
    {
      key: 'lastActive',
      label: 'Last Active'
    }
  ],
  rows: [
    {
      id: 1,
      name: 'Alex Carter',
      role: 'Product Designer',
      status: 'active',
      lastActive: '2 hours ago',
      avatar: 'https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?w=80&h=80&fit=crop'
    },
    {
      id: 2,
      name: 'Priya Shah',
      role: 'Frontend Engineer',
      status: 'in-review',
      lastActive: '1 day ago',
      avatar: 'https://images.unsplash.com/photo-1494790108377-be9c29b29330?w=80&h=80&fit=crop'
    },
    {
      id: 3,
      name: 'Marcus Lee',
      role: 'Product Manager',
      status: 'active',
      lastActive: '5 hours ago',
      avatar: 'https://images.unsplash.com/photo-1472099645785-5658abf4ff4e?w=80&h=80&fit=crop'
    },
    {
      id: 4,
      name: 'Elena Garcia',
      role: 'UX Researcher',
      status: 'away',
      lastActive: '2 days ago',
      avatar: 'https://images.unsplash.com/photo-1438761681033-6461ffad8d80?w=80&h=80&fit=crop'
    },
    {
      id: 5,
      name: 'Daniel Kim',
      role: 'DevOps Engineer',
      status: 'inactive',
      lastActive: '1 week ago',
      disabledActions: true
    },
    {
      id: 6,
      name: 'Sophia Chen',
      role: 'Data Analyst',
      status: 'active',
      lastActive: '3 hours ago',
      expandedContent: 'Expanded details for Sophia Chen.'
    }
  ],
  selectable: true,
  multiple: true
}
const selected = ref([
  1
])
const sort = ref([
  {
    key: 'name',
    direction: 'asc'
  }
])
const search = ref('')
const page = ref(1)
</script>

<template>
  <div style="display:grid;gap:12px"><VTable v-bind="args" v-model:selected="selected" v-model:sort="sort" v-model:search="search" v-model:page="page" /><code>selected = {{ JSON.stringify(selected) }} · sort = {{ JSON.stringify(sort) }} · search = "{{ search }}" · page = {{ page }}</code></div>
</template>

Acessibilidade

  • Navegação por teclado (Tab, Shift+Tab, arrows); semântica de tabela (table/thead/tbody/th/td); elementos focáveis (headers, rows, checkboxes, actions); colunas ordenáveis anunciam aria-sort; seleção com aria-selected; contraste WCAG 2.1 AA (4.5:1); loading & empty states anunciados; todas as ações via teclado/tecnologia assistiva.

Props

PropTipoDefaultDescrição
columnsVTableColumn[][]—
rowsVTableRow[][]—
rowActionsVDropdownMenuItem[][]Default items for each row's "…" menu. A row's own `actions` take precedence.
variantVTableVariant"default"—
sizeVTableSize"default"—
loadingbooleanfalse—
selectablebooleantrue—
multiplebooleantrue—
selectedArray<string | number>
(string | number)[]
——
sortVTableSortState[]——
searchstring——
showToolbarbooleantrue—
showActionsbooleantrueTrailing row-actions column. Default true (always off for `comparison`).
showPaginationbooleantruePagination footer. Default true (always off for `comparison`).
pagenumber1—
pageSizenumber10—
totalnumber——
expandedRowstring | number | null——
dataTestIdstring——

Events

EventoPayloadDescrição
@update:selectedArray<string | number>—
@update:sortimport('./VTable.types').VTableSortState[]—
@update:searchstring—
@update:pagenumber—
@update:pageSizenumber—
@update:expandedRowstring | number | null—
@row-click{ row: import('./VTable.types').VTableRow; index: number }—
@row-actionimport('./VTable.types').VTableRowActionEvent—
@filter——
@add——

Slots

SlotProps do slot
#[`header-${column.key}`]column
#[`cell-${column.key}`]rowvaluecolumnindex

Fonte: src/components/table/VTable/VTable.vue · tipos: src/components/table/VTable/VTable.types.ts