Table
A responsive table component.
| Status | Amount | |
|---|---|---|
| Success | ken99@example.com | $316.00 |
| Success | abe45@example.com | $242.00 |
| Processing | monserrat44@example.com | $837.00 |
| Failed | carmella@example.com | $721.00 |
Table — <table> HTML natif stylé shadcn. Composé de Table + TableHeader + TableBody + TableRow + TableHead (th) + TableCell (td) + optionnellement TableFooter + TableCaption.
Pour du filtrage / pagination / sorting côté serveur, utiliser DataTable qui étend Table avec toolbar.
Installation
$ bext ui add table
Copy and paste the following into src/components/ui/table.tsx.
Usage
Anatomy
<Table> ├── <TableCaption>...</TableCaption> // optionnel ├── <TableHeader> │ └── <TableRow> │ └── <TableHead>Column</TableHead> ├── <TableBody> │ └── <TableRow> │ └── <TableCell>value</TableCell> └── <TableFooter>...</TableFooter> // optionnel
API Reference
Table
| Prop | Type | Default | Description |
|---|---|---|---|
| head | string[] | — | Raccourci — génère TableHeader depuis un array de labels. |
| rows | string[][] | — | Raccourci — génère TableBody depuis une matrix de cells. |
| className | string | — | undefined |
TableHeader / TableBody / TableFooter
| Prop | Type | Default | Description |
|---|---|---|---|
| children | ReactNode | — | undefined |
TableRow
| Prop | Type | Default | Description |
|---|---|---|---|
| className | string | — | hover:bg-muted/50 par défaut. |
TableHead
| Prop | Type | Default | Description | |
|---|---|---|---|---|
| children | ReactNode | — | stylé h-10 px-4 text-left align-middle font-medium. |
TableCell
| Prop | Type | Default | Description | |
|---|---|---|---|---|
| children | ReactNode | — | p-4 align-middle. |
Accessibility
Utiliser TableCaption pour décrire la table aux AT. Ajouter scope="col" aux TableHead pour lier lignes ↔ colonnes.
Edit this example live in the bext playground — it compiles and runs entirely in your browser.
The React idiom — same UI, for comparison.
On This Page