Invoice list
Compare several records with aligned totals and clear column headers.
Components / Data
Compose responsive data tables with semantic rows, headers, and cells.
Last changed in version 0.14.2: Improve keyboard navigation, action feedback, and selected colors across Vue components.
| Invoice | Customer | Status | Total |
|---|---|---|---|
| INV-1042 | Ana Martins | Paid | €420.00 |
| INV-1043 | Northstar SARL | Pending | €86.00 |
| INV-1044 | Studio Forma | Draft | €1,195.00 |
The showcase also uses Chip for payment status.
bunx --bun @getweini/cli@latest add table chipImport the files copied by the install command, then place the component in your Vue template. The text and values in the example belong to your app; change them to fit your task.
| Invoice | Customer | Status | Total |
|---|---|---|---|
| INV-1042 | Ana Martins | M3.37 10.17a.5.5 0 0 0-.74.66l4 4.5c.19.22.52.23.72.02l10.5-10.5a.5.5 0 0 0-.7-.7L7.02 14.27z | €420.00 |
| INV-1043 | Northstar SARL | M3.37 10.17a.5.5 0 0 0-.74.66l4 4.5c.19.22.52.23.72.02l10.5-10.5a.5.5 0 0 0-.7-.7L7.02 14.27z | €86.00 |
| INV-1044 | Studio Forma | M3.37 10.17a.5.5 0 0 0-.74.66l4 4.5c.19.22.52.23.72.02l10.5-10.5a.5.5 0 0 0-.7-.7L7.02 14.27z | €1,195.00 |
<script setup lang="ts">
import Chip from './components/ui/chip/Chip.vue'
import Table from './components/ui/table/Table.vue'
import TableBody from './components/ui/table/TableBody.vue'
import TableCell from './components/ui/table/TableCell.vue'
import TableHeader from './components/ui/table/TableHeader.vue'
import TableRow from './components/ui/table/TableRow.vue'
import type { TableColumn } from './components/ui/table/types'
const columns: TableColumn[] = [
{ key: 'invoice', label: 'Invoice', align: 'start' },
{ key: 'customer', label: 'Customer', align: 'start' },
{ key: 'status', label: 'Status', align: 'center' },
{ key: 'total', label: 'Total', align: 'end' },
]
const rows = [
{
id: 'INV-1042',
customer: 'Ana Martins',
status:
'M3.37 10.17a.5.5 0 0 0-.74.66l4 4.5c.19.22.52.23.72.02l10.5-10.5a.5.5 0 0 0-.7-.7L7.02 14.27z',
total: '€420.00',
color: 'var(--success)',
},
{
id: 'INV-1043',
customer: 'Northstar SARL',
status:
'M3.37 10.17a.5.5 0 0 0-.74.66l4 4.5c.19.22.52.23.72.02l10.5-10.5a.5.5 0 0 0-.7-.7L7.02 14.27z',
total: '€86.00',
color: 'var(--warning)',
},
{
id: 'INV-1044',
customer: 'Studio Forma',
status:
'M3.37 10.17a.5.5 0 0 0-.74.66l4 4.5c.19.22.52.23.72.02l10.5-10.5a.5.5 0 0 0-.7-.7L7.02 14.27z',
total: '€1,195.00',
color: 'var(--secondary-foreground)',
},
]
// Fluent UI System Icons, regular 20px glyphs, kept in the application example.
const headerIcons: Record<string, string> = {
invoice:
'M6 2a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h8a2 2 0 0 0 2-2V7.41c0-.4-.16-.78-.44-1.06l-3.91-3.91A1.5 1.5 0 0 0 10.59 2zM5 4a1 1 0 0 1 1-1h4v3.5c0 .83.67 1.5 1.5 1.5H15v8a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1zm9.8 3h-3.3a.5.5 0 0 1-.5-.5V3.2z',
customer:
'M10 2a4 4 0 1 0 0 8 4 4 0 0 0 0-8M7 6a3 3 0 1 1 6 0 3 3 0 0 1-6 0m-2 5a2 2 0 0 0-2 2c0 1.7.83 2.97 2.13 3.8A9 9 0 0 0 10 18c1.85 0 3.58-.39 4.87-1.2A4.4 4.4 0 0 0 17 13a2 2 0 0 0-2-2zm-1 2a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1c0 1.3-.62 2.28-1.67 2.95A8 8 0 0 1 10 17a8 8 0 0 1-4.33-1.05A3.4 3.4 0 0 1 4 13',
status:
'M10 2a8 8 0 1 1 0 16 8 8 0 0 1 0-16m0 1a7 7 0 1 0 0 14 7 7 0 0 0 0-14m3.36 4.65c.17.17.2.44.06.63l-.06.07-4 4a.5.5 0 0 1-.64.07l-.07-.06-2-2a.5.5 0 0 1 .63-.77l.07.06L9 11.3l3.65-3.65c.2-.2.51-.2.7 0',
total:
'M7 9a2 2 0 1 1 4 0 2 2 0 0 1-4 0m2-1a1 1 0 1 0 0 2 1 1 0 0 0 0-2M3.5 4C2.67 4 2 4.67 2 5.5v7c0 .83.67 1.5 1.5 1.5h11c.83 0 1.5-.67 1.5-1.5v-7c0-.83-.67-1.5-1.5-1.5zM3 5.5c0-.28.22-.5.5-.5H5v1a1 1 0 0 1-1 1H3zM3 8h1a2 2 0 0 0 2-2V5h6v1c0 1.1.9 2 2 2h1v2h-1a2 2 0 0 0-2 2v1H6v-1a2 2 0 0 0-2-2H3zm10-3h1.5c.28 0 .5.22.5.5V7h-1a1 1 0 0 1-1-1zm2 6v1.5a.5.5 0 0 1-.5.5H13v-1a1 1 0 0 1 1-1zM5 13H3.5a.5.5 0 0 1-.5-.5V11h1a1 1 0 0 1 1 1zm12-.5a2.5 2.5 0 0 1-2.5 2.5H4.09c.2.58.76 1 1.41 1h9a3.5 3.5 0 0 0 3.5-3.5v-5c0-.65-.42-1.2-1-1.41z',
}
</script>
<template>
<div class="w-full">
<Table aria-label="Recent invoices" size="sm">
<TableHeader :columns="columns">
<template #column="{ column }">
<span v-if="typeof column !== 'string'" class="inline-flex items-center gap-1.5">
<svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" class="size-4 shrink-0">
<path :d="headerIcons[column.key]" />
</svg>
{{ column.label }}
</span>
<template v-else>{{ column }}</template>
</template>
</TableHeader>
<TableBody>
<TableRow v-for="row in rows" :key="row.id">
<TableCell align="start" class="font-medium">{{ row.id }}</TableCell>
<TableCell align="start">{{ row.customer }}</TableCell>
<TableCell align="center"><Chip :color="row.color">{{ row.status }}</Chip></TableCell>
<TableCell align="end" class="tabular-nums">{{ row.total }}</TableCell>
</TableRow>
</TableBody>
</Table>
</div>
</template>The showcase uses horizontal separators between rows, with no vertical cell borders and the standard outer table border. It uses TableHeader’s scoped column slot for Fluent header icons, start-aligned invoice and customer cells, centered Chip statuses, and end-aligned amounts with tabular-nums. Set align independently on each TableHead or TableCell; start and end follow the reading direction. Use TableHeader columns for a simple header, or compose TableRow and TableHead for grouped headers. Add sorting, filtering, selection, pagination, or server data in your application.
Compare several records with aligned totals and clear column headers.
Display the current sort direction on the sorted header.
Build a semantic table with a header definition and body rows.
<script setup lang="ts">
import Table from './components/ui/table/Table.vue'
import TableBody from './components/ui/table/TableBody.vue'
import TableCell from './components/ui/table/TableCell.vue'
import TableHeader from './components/ui/table/TableHeader.vue'
import TableRow from './components/ui/table/TableRow.vue'
const columns = [
{ key: 'invoice', label: 'Invoice' },
{ key: 'total', label: 'Total', align: 'end' as const },
]
const rows = [
{ id: 'INV-1042', total: '€420' },
{ id: 'INV-1043', total: '€85' },
]
</script>
<template>
<Table aria-label="Invoices">
<TableHeader :columns="columns" />
<TableBody>
<TableRow v-for="row in rows" :key="row.id">
<TableCell>{{ row.id }}</TableCell>
<TableCell align="end">{{ row.total }}</TableCell>
</TableRow>
</TableBody>
</Table>
</template>Expose the currently sorted column in the header.
<script setup lang="ts">
import Table from './components/ui/table/Table.vue'
import TableBody from './components/ui/table/TableBody.vue'
import TableCell from './components/ui/table/TableCell.vue'
import TableHeader from './components/ui/table/TableHeader.vue'
import TableRow from './components/ui/table/TableRow.vue'
const columns = [
{ key: 'name', label: 'Name', ariaSort: 'ascending' as const },
{ key: 'stock', label: 'In stock', align: 'end' as const },
]
</script>
<template>
<Table aria-label="Inventory" size="sm">
<TableHeader :columns="columns" />
<TableBody>
<TableRow>
<TableCell>Notebook</TableCell>
<TableCell align="end">24</TableCell>
</TableRow>
</TableBody>
</Table>
</template>Every public prop, model, event, slot, and exposed member of the installed Vue parts is listed below. “Not set” means you can leave that value out; “Required” means you must provide it. Native HTML attributes also work where the component uses a native element.
| Name | Type or signature | Default | What it does |
|---|---|---|---|
sizeprop | "sm" | "md" | "lg" | undefined | "md" | Choose the visual size. Medium is the usual default where available. |
defaultslot | () => unknown | Required | Content shown inside Table. |
containerexposed | HTMLDivElement | null | — | Access container from a component template ref. |
elementexposed | HTMLTableElement | null | — | Reference to the underlying HTML element. |
| Name | Type or signature | Default | What it does |
|---|---|---|---|
defaultslot | () => unknown | Required | Content shown inside TableBody. |
| Name | Type or signature | Default | What it does |
|---|---|---|---|
defaultslot | () => unknown | Required | Content shown inside TableCaption. |
| Name | Type or signature | Default | What it does |
|---|---|---|---|
alignprop | "start" | "end" | "center" | undefined | "start" | Choose how content aligns within its container. |
defaultslot | () => unknown | Required | Content shown inside TableCell. |
| Name | Type or signature | Default | What it does |
|---|---|---|---|
defaultslot | () => unknown | Required | Content shown inside TableFooter. |
| Name | Type or signature | Default | What it does |
|---|---|---|---|
scopeprop | TableHeadScope | undefined | "col" | Choose which elements this behavior applies to. |
ariaSortprop | TableSortDirection | undefined | Not set | Describe how this table column is sorted. |
alignprop | "start" | "end" | "center" | undefined | "start" | Choose how content aligns within its container. |
defaultslot | () => unknown | Required | Content shown inside TableHead. |
| Name | Type or signature | Default | What it does |
|---|---|---|---|
columnsprop | readonly TableHeaderColumn[] | undefined | [] | Define the columns shown in the table. |
defaultslot | () => unknown | Required | Content shown inside TableHeader. |
columnslot | (props: { column: TableHeaderColumn; index: number; }) => unknown | Required | Content for the column area of TableHeader. |
| Name | Type or signature | Default | What it does |
|---|---|---|---|
defaultslot | () => unknown | Required | Content shown inside TableRow. |
// packages/frameworks/vue/components/table/types.ts
// ------- IMPORTS -------
import type { tableAlignments, tableHeadSizes } from './styles'
// ------- TYPES -------
export type TableSortDirection = 'none' | 'ascending' | 'descending' | 'other'
export type TableAlignment = keyof typeof tableAlignments
export type TableHeadScope = 'col' | 'row' | 'colgroup' | 'rowgroup'
export interface TableColumn {
key: string
label: string
align?: TableAlignment
scope?: TableHeadScope
ariaSort?: TableSortDirection
}
export type TableHeaderColumn = string | TableColumn
export interface TableProps {
size?: keyof typeof tableHeadSizes
}
export interface TableHeadProps {
scope?: TableHeadScope
ariaSort?: TableSortDirection
align?: TableAlignment
}
export interface TableCellProps {
align?: TableAlignment
}
export interface TableHeaderProps {
columns?: readonly TableHeaderColumn[]
}
// packages/frameworks/vue/components/table/styles.ts
// Edit table density here; heading and data cells use the same size keys.
export const tableHeadSizes = {
sm: 'h-8 px-2.5 text-xs',
md: 'h-10 px-3.5 text-sm',
lg: 'h-12 px-5 text-base',
} as const
export const tableCellSizes: Record<keyof typeof tableHeadSizes, string> = {
sm: 'px-2.5 py-1.5 text-xs',
md: 'px-3.5 py-2.5 text-sm',
lg: 'px-5 py-3.5 text-base',
}
export const tableAlignments = {
start: 'text-start',
center: 'text-center',
end: 'text-end',
} as const