Table

A responsive table element used as the base for data tables.

Loading preview…

Installation

Usage

Use table primitives for structured tabular data. Compose Header, Body, Footer, Row, Head, Cell, and Caption around Root.

1<script lang="ts">
2	import * as Table from '~/components/table';
3</script>
4
5<Table.Root>
6	<Table.Caption>A list of your recent invoices.</Table.Caption>
7	<Table.Header>
8		<Table.Row>
9			<Table.Head class="w-[100px]">Invoice</Table.Head>
10			<Table.Head>Status</Table.Head>
11			<Table.Head class="text-end">Amount</Table.Head>
12		</Table.Row>
13	</Table.Header>
14	<Table.Body>
15		<Table.Row>
16			<Table.Cell class="font-medium">INV001</Table.Cell>
17			<Table.Cell>Paid</Table.Cell>
18			<Table.Cell class="text-end">$250.00</Table.Cell>
19		</Table.Row>
20	</Table.Body>
21	<Table.Footer>
22		<Table.Row>
23			<Table.Cell colspan={2}>Total</Table.Cell>
24			<Table.Cell class="text-end">$250.00</Table.Cell>
25		</Table.Row>
26	</Table.Footer>
27</Table.Root>