Table
A responsive table component for displaying tabular data.
| Invoice | Status | Method | Amount |
|---|---|---|---|
| INV001 | Paid | Credit Card | $250.00 |
| INV002 | Pending | PayPal | $150.00 |
| INV003 | Unpaid | Bank Transfer | $350.00 |
| Total | $750.00 | ||
Installation
npx shadcn-vue@latest add https://vuedocs.canceydejean.dev/r/table.jsonUsage
Compose a table from the primitive parts below for simple, static tabular data. TableEmpty
renders a full-width row for empty states, and utils.ts exports a valueUpdater helper for
wiring up @tanstack/vue-table's reactive state when you need sorting, filtering, or pagination.
<script setup lang="ts">
import {
Table,
TableBody,
TableCaption,
TableCell,
TableFooter,
TableHead,
TableHeader,
TableRow,
} from "@/components/ui/table";
const invoices = [
{ invoice: "INV001", status: "Paid", method: "Credit Card", amount: "$250.00" },
{ invoice: "INV002", status: "Pending", method: "PayPal", amount: "$150.00" },
];
</script>
<template>
<Table>
<TableCaption>A list of your recent invoices.</TableCaption>
<TableHeader>
<TableRow>
<TableHead>Invoice</TableHead>
<TableHead>Status</TableHead>
<TableHead>Method</TableHead>
<TableHead class="text-right">Amount</TableHead>
</TableRow>
</TableHeader>
<TableBody>
<TableRow v-for="row in invoices" :key="row.invoice">
<TableCell>{{ row.invoice }}</TableCell>
<TableCell>{{ row.status }}</TableCell>
<TableCell>{{ row.method }}</TableCell>
<TableCell class="text-right">{{ row.amount }}</TableCell>
</TableRow>
</TableBody>
<TableFooter>
<TableRow>
<TableCell colspan="3">Total</TableCell>
<TableCell class="text-right">$400.00</TableCell>
</TableRow>
</TableFooter>
</Table>
</template>