Install
Pull Table from the barrel for everyday use, or the granular path when you want a tighter bundle.
import { Table } from "@brika/clay";import { Table } from "@brika/clay/components/table";A minimal example
Drop this into a page. Native HTML attributes pass through to the underlying primitive.
import { Badge } from '@brika/clay/components/badge';
import {
Table,
TableBody,
TableCaption,
TableCell,
TableHead,
TableHeader,
TableRow,
} from '@brika/clay/components/table';
const members = [
{ name: 'Alicia Reyes', email: 'alicia@brika.io', role: 'Admin', status: 'Active' },
{ name: 'Tom Hargreaves', email: 'tom@brika.io', role: 'Developer', status: 'Active' },
{ name: 'Yuki Tanaka', email: 'yuki@brika.io', role: 'Designer', status: 'Inactive' },
{ name: 'Dmitri Volkov', email: 'dmitri@brika.io', role: 'Developer', status: 'Active' },
];
/** Full workspace members table with name, email, role, and status columns. */
export default function TableDefaultDemo() {
return (
<Table>
<TableCaption>Workspace members</TableCaption>
<TableHeader>
<TableRow>
<TableHead>Name</TableHead>
<TableHead>Email</TableHead>
<TableHead>Role</TableHead>
<TableHead>Status</TableHead>
</TableRow>
</TableHeader>
<TableBody>
{members.map((m) => (
<TableRow key={m.email}>
<TableCell className="font-medium">{m.name}</TableCell>
<TableCell className="text-muted-foreground">{m.email}</TableCell>
<TableCell>{m.role}</TableCell>
<TableCell>
<Badge variant={m.status === 'Active' ? 'default' : 'outline'}>{m.status}</Badge>
</TableCell>
</TableRow>
))}
</TableBody>
</Table>
);
}Table, every way
Accessibility
- Use
<TableCaption>to describe the table, it becomes the accessible name viaaria-labelledby. - Sortable column headers should carry
aria-sort="ascending"or"descending". - Action buttons in cells require
aria-labelthat includes the row context (e.g. "Edit Alicia Reyes"). - The table responds to standard AT table-navigation keys (e.g. Ctrl+Alt+arrows in screen readers).
Theme tokens
Every CSS variable Table reads, with its default and the
dotted path you'd write in a ThemeConfig JSON
to override it. Set any of these in your theme to retune Table
without touching component code.
Table tokens
4 tokens--table-header-bgcolorvar(--muted)components.table.headerBgBackground for the table footer (and any consumer-defined header rows).
--table-row-hover-bgcolorvar(--muted)components.table.rowHoverBgBackground for hovered and selected rows; the hover state applies it at 50% opacity.
--table-head-colorcolorvar(--foreground)components.table.headColorForeground color of `<TableHead>` cells.
--table-caption-colorcolorvar(--muted-foreground)components.table.captionColorForeground color of the `<TableCaption>` rendered beneath the table.
Override in a theme
Authoring a theme is plain JSON. Drop overrides under
components.table, the names
are camelCase versions of the variable suffix.
{
"id": "my-theme",
"name": "My Theme",
"description": "...",
"accentSwatches": ["#000"],
"components": {
"table": {
"headerBg": "var(--muted)"
}
}
}
Then apply with applyTheme(myTheme)
(see the theming guide),
scope it to a subtree with themeToCssVars(myTheme, mode),
or consume any token directly in your own JSX with the matching Tailwind utility
(e.g. bg-table-…) — see the
chips on each token row.
API reference
Props specific to Table. Native HTML attributes pass through to the underlying primitive, see the component source on GitHub for the full type signature.
<Table />
passthroughNo wrapper-specific props, all attributes pass through to the underlying primitive.
<TableBody />
passthroughNo wrapper-specific props, all attributes pass through to the underlying primitive.
<TableCaption />
passthroughNo wrapper-specific props, all attributes pass through to the underlying primitive.
<TableCell />
passthroughNo wrapper-specific props, all attributes pass through to the underlying primitive.
<TableFooter />
passthroughNo wrapper-specific props, all attributes pass through to the underlying primitive.
<TableHead />
passthroughNo wrapper-specific props, all attributes pass through to the underlying primitive.
<TableHeader />
passthroughNo wrapper-specific props, all attributes pass through to the underlying primitive.
<TableRow />
passthroughNo wrapper-specific props, all attributes pass through to the underlying primitive.