Table
A semantic table with striping, hover states, sticky headers and two variants.
| Version | Released | Status |
|---|---|---|
| 0.3.0 | Jun 28 | Stable |
| 0.2.1 | Jun 14 | Stable |
| 0.2.0 | Jun 02 | Deprecated |
"use client";
import { Table, Badge, Box } from "astralis-ui";
const releases = [
{ version: "0.3.0", date: "Jun 28", status: "Stable", scheme: "green" },
{ version: "0.2.1", date: "Jun 14", status: "Stable", scheme: "green" },
{ version: "0.2.0", date: "Jun 02", status: "Deprecated", scheme: "orange" },
] as const;
export function TableDemo() {
return (
<Box w="full" maxW="md">
<Table variant="outline" striped interactive>
<Table.Header>
<Table.Row>
<Table.Head>Version</Table.Head>
<Table.Head>Released</Table.Head>
<Table.Head>Status</Table.Head>
</Table.Row>
</Table.Header>
<Table.Body>
{releases.map((release) => (
<Table.Row key={release.version}>
<Table.Cell>{release.version}</Table.Cell>
<Table.Cell>{release.date}</Table.Cell>
<Table.Cell>
<Badge colorScheme={release.scheme}>{release.status}</Badge>
</Table.Cell>
</Table.Row>
))}
</Table.Body>
<Table.Caption>Astralis UI release history</Table.Caption>
</Table>
</Box>
);
}Import#
import { Table } from "astralis-ui";
// Table.Header, .Body, .Footer, .Row, .Head, .Cell, .CaptionUsage#
The compound parts map one-to-one onto native table elements — you keep full control of rows and cells, and the root handles horizontal overflow with its own scroll container.
Props#
| Prop | Type | Default | Description |
|---|---|---|---|
variant | "line" | "outline" | "line" | Subtle row dividers, or a bordered box. |
size | "sm" | "md" | "lg" | "md" | Cell padding and text size. |
striped | boolean | false | Alternate row backgrounds. |
interactive | boolean | false | Row highlight on hover. |
stickyHeader | boolean | false | Header pins while the body scrolls. |
Table.Head defaults scope="col"; Table.Caption takes
placement: "top" | "bottom" (default bottom). All parts forward their
native element attributes.
Accessibility#
Real table/thead/th[scope]/caption semantics — screen readers get
the table for free; striping and hover are purely visual.