Data table
VDataTable displays rows with search, sorting, selection and pagination. Process data locally or use server mode to request each result set.
Usage
<script setup lang="ts">
import { VDataTable } from 'vectis-ui'
const columns = [
{ key: 'name', label: 'Project' },
{ key: 'owner', label: 'Owner' },
{ key: 'commits', label: 'Commits' },
]
const rows = [
{ name: 'Vectis UI', owner: 'Ada Lovelace', commits: 320 },
{ name: 'Atlas', owner: 'Grace Hopper', commits: 87 },
{ name: 'Meridian', owner: 'Alan Turing', commits: 44 },
]
</script>
<template>
<VDataTable :columns="columns" :rows="rows" row-key="name" title="Projects" />
</template>Examples
Sorting
Mark columns sortable. Their headings cycle through ascending, descending and original order. Observe or set the sort with v-model:sort.
Sorted by commits, descending
<script setup lang="ts">
import { ref } from 'vue'
import { VDataTable, type DataTableSort } from 'vectis-ui'
const columns = [
{ key: 'name', label: 'Project', sortable: true },
{ key: 'owner', label: 'Owner' },
{ key: 'status', label: 'Status', sortable: true },
{ key: 'commits', label: 'Commits', sortable: true, align: 'end' as const },
]
const rows = [
{ name: 'Vectis', owner: 'Xavier', status: 'Active', commits: 320 },
{ name: 'Atlas', owner: 'Nadia', status: 'Active', commits: 87 },
{ name: 'Brume', owner: 'Louis', status: 'Archived', commits: 1204 },
{ name: 'Granit', owner: 'Emma', status: 'Active', commits: 45 },
]
const sort = ref<DataTableSort | null>({ key: 'commits', direction: 'desc' })
const DIRECTIONS = { asc: 'ascending', desc: 'descending' }
</script>
<template>
<div class="demo">
<VDataTable
v-model:sort="sort"
:columns="columns"
:rows="rows"
row-key="name"
title="Projects"
/>
<p class="state">
Sorted by {{ sort ? `${sort.key}, ${DIRECTIONS[sort.direction]}` : 'nothing' }}
</p>
</div>
</template>
<style scoped>
.demo {
display: grid;
gap: var(--vectis-space-3);
}
.state {
margin: 0;
color: var(--vectis-color-text-muted);
font-size: var(--vectis-text-body-sm-size);
}
</style>Search
searchable adds a field searching declared columns without case or accent sensitivity. Control the query with v-model:search.
<script setup lang="ts">
import { VDataTable } from 'vectis-ui'
const columns = [
{ key: 'name', label: 'Project', sortable: true },
{ key: 'owner', label: 'Owner' },
{ key: 'status', label: 'Status' },
{ key: 'commits', label: 'Commits', align: 'end' as const },
]
const rows = [
{ name: 'Vectis', owner: 'Xavier', status: 'Active', commits: 320 },
{ name: 'Atlas', owner: 'Nadia', status: 'Active', commits: 87 },
{ name: 'Brume', owner: 'Louis', status: 'Archived', commits: 1204 },
{ name: 'Granit', owner: 'Emma', status: 'Active', commits: 45 },
{ name: 'Éclair', owner: 'Xavier', status: 'Active', commits: 296 },
{ name: 'Falaise', owner: 'Nadia', status: 'Archived', commits: 133 },
{ name: 'Givre', owner: 'Louis', status: 'Active', commits: 58 },
{ name: 'Houle', owner: 'Emma', status: 'Active', commits: 411 },
]
</script>
<template>
<VDataTable
:columns="columns"
:rows="rows"
row-key="name"
title="Projects"
searchable
search-placeholder="Search projects"
search-label="Search the projects"
/>
</template>Set v-model:per-page above 0 to enable pagination. showRange displays the visible row range.
<script setup lang="ts">
import { VDataTable } from 'vectis-ui'
const columns = [
{ key: 'name', label: 'Project', sortable: true },
{ key: 'owner', label: 'Owner' },
{ key: 'status', label: 'Status' },
{ key: 'commits', label: 'Commits', sortable: true, align: 'end' as const },
]
const NAMES = [
'Vectis',
'Atlas',
'Brume',
'Granit',
'Éclair',
'Falaise',
'Givre',
'Houle',
'Islet',
'Jade',
'Karst',
'Lande',
'Mistral',
'Nacre',
'Ombre',
'Pollen',
'Quartz',
'Rivage',
'Sillage',
'Tuile',
'Vigie',
'Zenith',
]
const OWNERS = ['Xavier', 'Nadia', 'Louis', 'Emma']
const rows = NAMES.map((name, index) => ({
name,
owner: OWNERS[index % OWNERS.length],
status: index % 3 === 0 ? 'Archived' : 'Active',
commits: ((index + 3) * 37) % 500,
}))
</script>
<template>
<VDataTable
:columns="columns"
:rows="rows"
row-key="name"
title="Projects"
searchable
:per-page="6"
show-range
/>
</template>Rows per page
perPageOptions offers page sizes in the footer.
<script setup lang="ts">
import { ref } from 'vue'
import { VDataTable } from 'vectis-ui'
const columns = [
{ key: 'name', label: 'Project', sortable: true },
{ key: 'owner', label: 'Owner' },
{ key: 'status', label: 'Status' },
{ key: 'commits', label: 'Commits', sortable: true, align: 'end' as const },
]
const NAMES = [
'Vectis',
'Atlas',
'Brume',
'Granit',
'Éclair',
'Falaise',
'Givre',
'Houle',
'Islet',
'Jade',
'Karst',
'Lande',
'Mistral',
'Nacre',
'Ombre',
'Pollen',
'Quartz',
'Rivage',
'Sillage',
'Tuile',
'Vigie',
'Zenith',
]
const OWNERS = ['Xavier', 'Nadia', 'Louis', 'Emma']
const rows = NAMES.map((name, index) => ({
name,
owner: OWNERS[index % OWNERS.length],
status: index % 3 === 0 ? 'Archived' : 'Active',
commits: ((index + 3) * 37) % 500,
}))
const perPage = ref(5)
</script>
<template>
<VDataTable
v-model:per-page="perPage"
:columns="columns"
:rows="rows"
row-key="name"
title="Projects"
:per-page-options="[5, 10, 25]"
show-range
/>
</template>Selection
selectable adds row checkboxes and a page-wide checkbox. Provide a stable rowKey; v-model:selected contains those identifiers.
<script setup lang="ts">
import { ref } from 'vue'
import { VDataTable, type DataTableRowId } from 'vectis-ui'
const columns = [
{ key: 'name', label: 'Project', sortable: true },
{ key: 'owner', label: 'Owner' },
{ key: 'status', label: 'Status' },
{ key: 'commits', label: 'Commits', sortable: true, align: 'end' as const },
]
const rows = [
{ name: 'Vectis', owner: 'Xavier', status: 'Active', commits: 320 },
{ name: 'Atlas', owner: 'Nadia', status: 'Active', commits: 87 },
{ name: 'Brume', owner: 'Louis', status: 'Archived', commits: 1204 },
{ name: 'Granit', owner: 'Emma', status: 'Active', commits: 45 },
{ name: 'Éclair', owner: 'Xavier', status: 'Active', commits: 296 },
]
type Project = (typeof rows)[number]
const selected = ref<DataTableRowId[]>(['Atlas'])
const selectRowLabel = (row: Project) => `Select ${row.name}`
</script>
<template>
<div class="demo">
<VDataTable
v-model:selected="selected"
:columns="columns"
:rows="rows"
row-key="name"
title="Projects"
selectable
:select-row-label="selectRowLabel"
select-all-label="Select every project on this page"
/>
<p class="state">Selected: {{ selected.length ? selected.join(', ') : 'nothing' }}</p>
</div>
</template>
<style scoped>
.demo {
display: grid;
gap: var(--vectis-space-3);
}
.state {
margin: 0;
color: var(--vectis-color-text-muted);
font-size: var(--vectis-text-body-sm-size);
}
</style>subtitle describes the table under its title. The toolbar slot adds a row for actions and filters between the header and the table. The header slot replaces the title and subtitle; name the table with aria-label then.
<script setup lang="ts">
import { computed, ref } from 'vue'
import { VButton, VDataTable, VMenu, VMenuItem } from 'vectis-ui'
import { expand_more as expandMore } from 'vectis-ui/icons'
const columns = [
{ key: 'name', label: 'Project', sortable: true },
{ key: 'owner', label: 'Owner' },
{ key: 'status', label: 'Status' },
{ key: 'commits', label: 'Commits', sortable: true, align: 'end' as const },
]
const rows = [
{ name: 'Vectis', owner: 'Xavier', status: 'Active', commits: 320 },
{ name: 'Atlas', owner: 'Nadia', status: 'Active', commits: 87 },
{ name: 'Brume', owner: 'Louis', status: 'Archived', commits: 1204 },
{ name: 'Granit', owner: 'Emma', status: 'Active', commits: 45 },
{ name: 'Éclair', owner: 'Xavier', status: 'Archived', commits: 296 },
]
/* Apply the custom filter before the table's own search. */
const status = ref('All')
const filtered = computed(() =>
status.value === 'All' ? rows : rows.filter((row) => row.status === status.value),
)
</script>
<template>
<VDataTable
:columns="columns"
:rows="filtered"
row-key="name"
searchable
title="Projects"
subtitle="Every project in the organisation"
>
<template #toolbar>
<VMenu match-trigger>
<template #trigger="{ triggerProps }">
<VButton
v-bind="triggerProps"
variant="outline"
tone="neutral"
size="sm"
:icon-end="expandMore"
>
Status: {{ status }}
</VButton>
</template>
<VMenuItem
v-for="option in ['All', 'Active', 'Archived']"
:key="option"
:label="option"
@select="status = option"
/>
</VMenu>
<VButton size="sm">New project</VButton>
</template>
</VDataTable>
</template>Custom cells
A slot matching a column key replaces its cells. It receives the row, raw value and column; sorting and search still use the raw value.
<script setup lang="ts">
import { VAvatar, VChip, VDataTable } from 'vectis-ui'
const columns = [
{ key: 'name', label: 'Project', sortable: true },
{ key: 'owner', label: 'Owner' },
{ key: 'status', label: 'Status' },
{ key: 'commits', label: 'Commits', sortable: true, align: 'end' as const },
]
const rows = [
{ name: 'Vectis', owner: 'Xavier Darmet', status: 'Active', commits: 320 },
{ name: 'Atlas', owner: 'Nadia Rousseau', status: 'Active', commits: 87 },
{ name: 'Brume', owner: 'Louis Fabre', status: 'Archived', commits: 1204 },
{ name: 'Granit', owner: 'Emma Lefort', status: 'Active', commits: 45 },
]
const numbers = new Intl.NumberFormat('en-GB')
</script>
<template>
<VDataTable :columns="columns" :rows="rows" row-key="name" title="Projects">
<template #cell-owner="{ row }">
<span class="owner">
<VAvatar :name="row.owner" size="xs" />
{{ row.owner }}
</span>
</template>
<template #cell-status="{ row }">
<VChip :tone="row.status === 'Active' ? 'success' : 'neutral'" size="xs">
{{ row.status }}
</VChip>
</template>
<template #cell-commits="{ row }">
<span class="figure">{{ numbers.format(row.commits) }}</span>
</template>
</VDataTable>
</template>
<style scoped>
.owner {
display: inline-flex;
align-items: center;
gap: var(--vectis-space-2);
}
.figure {
font-variant-numeric: tabular-nums;
}
</style>Custom headings
Use head- followed by a column key to customize its heading. Sortable headings contain a button: keep slot content non-interactive.
<script setup lang="ts">
import { VDataTable, VIcon } from 'vectis-ui'
import { code, schedule } from 'vectis-ui/icons'
const columns = [
{ key: 'name', label: 'Project', sortable: true },
{ key: 'owner', label: 'Owner' },
{ key: 'updated', label: 'Last update' },
{ key: 'commits', label: 'Commits', sortable: true, align: 'end' as const },
]
const rows = [
{ name: 'Vectis', owner: 'Xavier', updated: '2 days ago', commits: 320 },
{ name: 'Atlas', owner: 'Nadia', updated: '3 weeks ago', commits: 87 },
{ name: 'Brume', owner: 'Louis', updated: 'Yesterday', commits: 1204 },
{ name: 'Granit', owner: 'Emma', updated: 'An hour ago', commits: 45 },
]
</script>
<template>
<VDataTable :columns="columns" :rows="rows" row-key="name" title="Projects">
<template #head-updated="{ column }">
<span class="heading"><VIcon :name="schedule" :size="16" />{{ column.label }}</span>
</template>
<!-- Sortable heading content sits inside a button; keep it non-interactive. -->
<template #head-commits="{ column }">
<span class="heading"><VIcon :name="code" :size="16" />{{ column.label }}</span>
</template>
</VDataTable>
</template>
<style scoped>
.heading {
display: inline-flex;
align-items: center;
gap: var(--vectis-space-1);
}
</style>Variants
flat leaves the table unframed. outline adds a border, elevated a raised surface with a shadow and filled a muted surface. The frame surrounds the rows and the footer; the header stays outside.
<script setup lang="ts">
import { VDataTable, type DataTableVariant } from 'vectis-ui'
const variants: DataTableVariant[] = ['flat', 'outline', 'elevated', 'filled']
const columns = [
{ key: 'name', label: 'Project', sortable: true },
{ key: 'owner', label: 'Owner' },
{ key: 'commits', label: 'Commits', sortable: true, align: 'end' as const },
]
const rows = [
{ name: 'Vectis', owner: 'Xavier', commits: 320 },
{ name: 'Atlas', owner: 'Nadia', commits: 87 },
{ name: 'Brume', owner: 'Louis', commits: 1204 },
]
</script>
<template>
<div class="stack">
<VDataTable
v-for="variant in variants"
:key="variant"
:variant="variant"
:columns="columns"
:rows="rows"
row-key="name"
:title="variant"
searchable
/>
</div>
</template>
<style scoped>
.stack {
display: grid;
gap: var(--vectis-space-6);
}
</style>Striped rows
striped tints alternate rows.
<script setup lang="ts">
import { VDataTable } from 'vectis-ui'
const columns = [
{ key: 'name', label: 'Project', sortable: true },
{ key: 'owner', label: 'Owner' },
{ key: 'status', label: 'Status' },
{ key: 'commits', label: 'Commits', sortable: true, align: 'end' as const },
]
const rows = [
{ name: 'Vectis', owner: 'Xavier', status: 'Active', commits: 320 },
{ name: 'Atlas', owner: 'Nadia', status: 'Active', commits: 87 },
{ name: 'Brume', owner: 'Louis', status: 'Archived', commits: 1204 },
{ name: 'Granit', owner: 'Emma', status: 'Active', commits: 45 },
{ name: 'Éclair', owner: 'Xavier', status: 'Active', commits: 296 },
{ name: 'Falaise', owner: 'Nadia', status: 'Archived', commits: 133 },
]
</script>
<template>
<VDataTable striped :columns="columns" :rows="rows" row-key="name" title="Projects" />
</template>stickyHeader keeps headings visible in a bounded scroll area. Set height or constrain the parent height.
<script setup lang="ts">
import { VDataTable } from 'vectis-ui'
const columns = [
{ key: 'name', label: 'Project', sortable: true },
{ key: 'owner', label: 'Owner' },
{ key: 'status', label: 'Status' },
{ key: 'commits', label: 'Commits', sortable: true, align: 'end' as const },
]
const NAMES = [
'Vectis',
'Atlas',
'Brume',
'Granit',
'Éclair',
'Falaise',
'Givre',
'Houle',
'Islet',
'Jade',
'Karst',
'Lande',
'Mistral',
'Nacre',
'Ombre',
'Pollen',
'Quartz',
'Rivage',
'Sillage',
'Tuile',
'Vigie',
'Zenith',
]
const OWNERS = ['Xavier', 'Nadia', 'Louis', 'Emma']
const rows = NAMES.map((name, index) => ({
name,
owner: OWNERS[index % OWNERS.length],
status: index % 3 === 0 ? 'Archived' : 'Active',
commits: ((index + 3) * 37) % 500,
}))
</script>
<template>
<VDataTable
sticky-header
variant="outline"
:height="320"
:columns="columns"
:rows="rows"
row-key="name"
title="Projects"
/>
</template>Full height
height bounds the whole component, including header, toolbar and footer. Numbers use pixels; strings use CSS lengths.
<script setup lang="ts">
import { VDataTable } from 'vectis-ui'
const columns = [
{ key: 'name', label: 'Project', sortable: true },
{ key: 'owner', label: 'Owner' },
{ key: 'status', label: 'Status' },
{ key: 'commits', label: 'Commits', sortable: true, align: 'end' as const },
]
const NAMES = [
'Vectis',
'Atlas',
'Brume',
'Granit',
'Éclair',
'Falaise',
'Givre',
'Houle',
'Islet',
'Jade',
'Karst',
'Lande',
]
const OWNERS = ['Xavier', 'Nadia', 'Louis', 'Emma']
const rows = NAMES.map((name, index) => ({
name,
owner: OWNERS[index % OWNERS.length],
status: index % 3 === 0 ? 'Archived' : 'Active',
commits: ((index + 3) * 37) % 500,
}))
</script>
<template>
<div class="panel">
<VDataTable
variant="outline"
sticky-header
:columns="columns"
:rows="rows"
row-key="name"
title="Projects"
searchable
:per-page="5"
:per-page-options="[5, 10]"
show-range
/>
</div>
</template>
<style scoped>
.panel {
block-size: 26rem;
}
</style>Server side
serverSide displays supplied rows without local search, sort or pagination. Listen to update:params, fetch the rows and provide total. searchDebounce delays search requests.
<script setup lang="ts">
import { onMounted, ref } from 'vue'
import { VDataTable, type DataTableParams } from 'vectis-ui'
const columns = [
{ key: 'name', label: 'Project', sortable: true },
{ key: 'owner', label: 'Owner' },
{ key: 'status', label: 'Status' },
{ key: 'commits', label: 'Commits', sortable: true, align: 'end' as const },
]
const NAMES = [
'Vectis',
'Atlas',
'Brume',
'Granit',
'Éclair',
'Falaise',
'Givre',
'Houle',
'Islet',
'Jade',
'Karst',
'Lande',
'Mistral',
'Nacre',
'Ombre',
'Pollen',
'Quartz',
'Rivage',
'Sillage',
'Tuile',
'Vigie',
'Zenith',
]
const OWNERS = ['Xavier', 'Nadia', 'Louis', 'Emma']
const DATA = NAMES.map((name, index) => ({
name,
owner: OWNERS[index % OWNERS.length],
status: index % 3 === 0 ? 'Archived' : 'Active',
commits: ((index + 3) * 37) % 500,
}))
type Project = (typeof DATA)[number]
const rows = ref<Project[]>([])
const total = ref(0)
const loading = ref(true)
/* Simulate the server response; production code would fetch these rows. */
function load(params: DataTableParams) {
loading.value = true
window.setTimeout(() => {
const term = params.search.trim().toLowerCase()
const matching = term
? DATA.filter((row) => `${row.name} ${row.owner} ${row.status}`.toLowerCase().includes(term))
: DATA
const key = params.sortKey as keyof Project | null
const sorted = key
? [...matching].sort(
(a, b) =>
String(a[key]).localeCompare(String(b[key]), 'en', { numeric: true }) *
(params.sortDirection === 'desc' ? -1 : 1),
)
: matching
const size = params.perPage ?? sorted.length
const start = (params.page - 1) * size
rows.value = sorted.slice(start, start + size)
total.value = sorted.length
loading.value = false
}, 600)
}
onMounted(() => load({ page: 1, perPage: 5, sortKey: null, sortDirection: null, search: '' }))
</script>
<template>
<VDataTable
server-side
variant="outline"
:columns="columns"
:rows="rows"
:total="total"
:loading="loading"
row-key="name"
title="Projects"
searchable
:per-page="5"
:per-page-options="[5, 10]"
show-range
@update:params="load"
/>
</template>Long tables
virtual renders only the rows near the visible part of the table, for tables of thousands of rows. Like stickyHeader, it needs a bounded height. Rows are measured as they render, and the heading checkbox still takes every row.
<script setup lang="ts">
import { ref } from 'vue'
import { VDataTable, type DataTableRowId } from 'vectis-ui'
const columns = [
{ key: 'name', label: 'Project', sortable: true },
{ key: 'owner', label: 'Owner' },
{ key: 'commits', label: 'Commits', sortable: true, align: 'end' as const },
]
const OWNERS = ['Xavier', 'Nadia', 'Louis', 'Emma']
const rows = Array.from({ length: 10000 }, (_, index) => ({
id: index + 1,
name: `Project ${index + 1}`,
owner: OWNERS[index % OWNERS.length],
commits: ((index + 3) * 37) % 500,
}))
const selected = ref<DataTableRowId[]>([])
</script>
<template>
<VDataTable
v-model:selected="selected"
virtual
sticky-header
selectable
variant="outline"
:height="400"
:columns="columns"
:rows="rows"
row-key="id"
title="Ten thousand projects"
/>
</template>hasMore emits load-more as the end of the rows comes into view. Append the next rows to rows; while loading, the rows already there stay on show.
<script setup lang="ts">
import { computed, ref } from 'vue'
import { VDataTable } from 'vectis-ui'
const columns = [
{ key: 'name', label: 'Event' },
{ key: 'owner', label: 'Author' },
]
const OWNERS = ['Xavier', 'Nadia', 'Louis', 'Emma']
const TOTAL = 150
function page(from: number) {
return Array.from({ length: 30 }, (_, i) => ({
id: from + i + 1,
name: `Event ${from + i + 1}`,
owner: OWNERS[(from + i) % OWNERS.length],
}))
}
const rows = ref(page(0))
const loading = ref(false)
const hasMore = computed(() => rows.value.length < TOTAL)
// Stands in for a request to your API.
function loadMore() {
loading.value = true
setTimeout(() => {
rows.value = [...rows.value, ...page(rows.value.length)]
loading.value = false
}, 600)
}
</script>
<template>
<VDataTable
virtual
sticky-header
variant="outline"
:height="360"
:columns="columns"
:rows="rows"
row-key="id"
:loading="loading"
:has-more="hasMore"
title="Activity"
@load-more="loadMore"
/>
</template>Loading and empty
Loading takes precedence over empty results. Customize these states with loadingText, emptyText or their slots.
<script setup lang="ts">
import { VDataTable } from 'vectis-ui'
const columns = [
{ key: 'name', label: 'Project' },
{ key: 'owner', label: 'Owner' },
{ key: 'commits', label: 'Commits', align: 'end' as const },
]
</script>
<template>
<div class="stack">
<VDataTable loading variant="outline" :columns="columns" :rows="[]" title="Loading" />
<VDataTable
variant="outline"
:columns="columns"
:rows="[]"
empty-text="No project yet"
title="Nothing to show"
/>
</div>
</template>
<style scoped>
.stack {
display: grid;
gap: var(--vectis-space-6);
}
</style>A complete table
Combines search, sorting, selection, custom cells and pagination.
<script setup lang="ts">
import { ref } from 'vue'
import { VAvatar, VChip, VDataTable, type DataTableRowId } from 'vectis-ui'
const columns = [
{ key: 'name', label: 'Project', sortable: true },
{ key: 'owner', label: 'Owner', sortable: true },
{ key: 'status', label: 'Status', sortable: true },
{ key: 'commits', label: 'Commits', sortable: true, align: 'end' as const },
]
const NAMES = [
'Vectis',
'Atlas',
'Brume',
'Granit',
'Éclair',
'Falaise',
'Givre',
'Houle',
'Islet',
'Jade',
'Karst',
'Lande',
'Mistral',
'Nacre',
'Ombre',
'Pollen',
'Quartz',
'Rivage',
'Sillage',
'Tuile',
'Vigie',
'Zenith',
]
const OWNERS = ['Xavier Darmet', 'Nadia Rousseau', 'Louis Fabre', 'Emma Lefort']
const rows = NAMES.map((name, index) => ({
name,
owner: OWNERS[index % OWNERS.length],
status: index % 3 === 0 ? 'Archived' : 'Active',
commits: ((index + 3) * 37) % 500,
}))
type Project = (typeof rows)[number]
const selected = ref<DataTableRowId[]>([])
const numbers = new Intl.NumberFormat('en-GB')
const selectRowLabel = (row: Project) => `Select ${row.name}`
const selectionText = (count: number) => `${count} project${count > 1 ? 's' : ''} selected`
</script>
<template>
<VDataTable
v-model:selected="selected"
variant="outline"
:columns="columns"
:rows="rows"
row-key="name"
title="Projects"
subtitle="Every project in the organisation"
searchable
search-placeholder="Search projects"
selectable
:select-row-label="selectRowLabel"
:selection-text="selectionText"
sticky-header
:height="420"
:per-page="8"
:per-page-options="[8, 16, 24]"
show-range
>
<template #cell-owner="{ row }">
<span class="owner">
<VAvatar :name="row.owner" size="xs" />
{{ row.owner }}
</span>
</template>
<template #cell-status="{ row }">
<VChip :tone="row.status === 'Active' ? 'success' : 'neutral'" size="xs">
{{ row.status }}
</VChip>
</template>
<template #cell-commits="{ row }">
<span class="figure">{{ numbers.format(row.commits) }}</span>
</template>
</VDataTable>
</template>
<style scoped>
.owner {
display: inline-flex;
align-items: center;
gap: var(--vectis-space-2);
}
.figure {
font-variant-numeric: tabular-nums;
}
</style>API
Props
Events
Slots
Types
Types used in the API tables. Import exported types from vectis-ui.
export interface BuiltinIcon {
name: string
paths: readonly [string] | readonly [string, string]
}export interface DataTableColumn {
key: string
label: string
sortable?: boolean
align?: DataTableColumnAlign
}export type DataTableColumnAlign = 'start' | 'center' | 'end'
export interface DataTableEmptySlotProps {
search: string
}export interface DataTableParams {
page: number
perPage: number | null
sortKey: string | null
sortDirection: DataTableSortDirection | null
search: string
}export interface DataTableRange {
start: number
end: number
total: number
}export type DataTableRowId = string | number
export interface DataTableSort {
key: string
direction: DataTableSortDirection
}export type DataTableSortDirection = 'asc' | 'desc'
export type IconRender =
| { path: string; viewBox?: string }
| { component: Component; props?: Record<string, unknown> }
| { src: string }
| { text: string; class?: string }
| { class: string }export type IconSource = string | BuiltinIcon | IconRender
CSS variables