Data Table
Structural parts for tabular data, extracted from the mockup’s .tscroll table. The wrapper scrolls horizontally so a wide table never breaks the page.
Interactive Preview
Section titled “Interactive Preview”import { Table, TableHeader, TableBody, TableRow, TableHead, TableCell, Badge } from "@/components/ui/data-table";
<Table> <TableHeader> <TableRow> <TableHead>Group</TableHead> <TableHead>Plan</TableHead> <TableHead>Status</TableHead> </TableRow> </TableHeader> <TableBody> <TableRow selected> <TableCell>7A</TableCell> <TableCell>Team</TableCell> <TableCell><Badge status="success">Active</Badge></TableCell> </TableRow> <TableRow clickable> <TableCell>7B</TableCell> <TableCell>Business</TableCell> <TableCell><Badge status="warning">Pending</Badge></TableCell> </TableRow> </TableBody></Table><script lang="ts"> import Table from "@/components/ui/table.svelte"; import TableHeader from "@/components/ui/table-header.svelte"; import TableBody from "@/components/ui/table-body.svelte"; import TableRow from "@/components/ui/table-row.svelte"; import TableHead from "@/components/ui/table-head.svelte"; import TableCell from "@/components/ui/table-cell.svelte";</script>
<Table> <TableHeader> <TableRow> <TableHead>Group</TableHead> <TableHead>Plan</TableHead> </TableRow> </TableHeader> <TableBody> <TableRow selected> <TableCell>7A</TableCell> <TableCell>Team</TableCell> </TableRow> <TableRow clickable> <TableCell>7B</TableCell> <TableCell>Business</TableCell> </TableRow> </TableBody></Table>import { Table, TableHeader, TableBody, TableRow, TableHead, TableCell } from "@/components/ui/data-table";
<Table> <TableHeader> <TableRow> <TableHead>Group</TableHead> <TableHead>Plan</TableHead> </TableRow> </TableHeader> <TableBody> <TableRow selected> <TableCell>7A</TableCell> <TableCell>Team</TableCell> </TableRow> <TableRow clickable> <TableCell>7B</TableCell> <TableCell>Business</TableCell> </TableRow> </TableBody></Table>Installation
Section titled “Installation”npx @glaceon/cli add data-table --framework react # or svelte, solidNo headless dependency, only the design tokens:
bun add @glaceon/tokensReact and Solid export all six parts from one module. Svelte needs one import per part:
import Table from '@glaceon/svelte/Table.svelte';import TableHeader from '@glaceon/svelte/TableHeader.svelte';import TableBody from '@glaceon/svelte/TableBody.svelte';import TableRow from '@glaceon/svelte/TableRow.svelte';import TableHead from '@glaceon/svelte/TableHead.svelte';import TableCell from '@glaceon/svelte/TableCell.svelte';Row states
Section titled “Row states”Selection and hover are separate, because a row can be selected and still be hovered. selected also sets aria-selected, so the state is announced rather than only coloured.
| Prop | Mockup source | Applied styling |
|---|---|---|
selected |
tbody tr.sel |
bg-green-soft, and aria-selected="true". Hover keeps the selected fill so the row does not flicker. |
clickable |
tbody tr.click:hover |
cursor-pointer plus hover:bg-surface-2. |
API Reference (Props)
Section titled “API Reference (Props)”| Component | Prop | Type | Default | Description |
|---|---|---|---|---|
Table |
class |
string |
undefined |
Wrapper classes. |
TableRow |
selected |
boolean |
false |
Selected fill plus aria-selected. |
TableRow |
clickable |
boolean |
false |
Pointer cursor and hover fill. |
| all parts | class / className |
string |
undefined |
Extra classes, appended last. |
Design notes
Section titled “Design notes”The wrapper is rounded-lg (8px), not the mockup’s 12px, because the system caps surface radii at 8px. The table uses border-collapse with a bottom border per row and last:border-b-0, so the final row does not double up on the wrapper’s own border. Header cells are --surface-2 against the --surface body, which is enough separation without a second border colour.