Skip to content

Search is only available in production builds. Try building and previewing the site to test it out locally.

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.

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>
Terminal window
npx @glaceon/cli add data-table --framework react # or svelte, solid

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.
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.

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.