bx

Table

A responsive table component.

StatusEmailAmount
Successken99@example.com$316.00
Successabe45@example.com$242.00
Processingmonserrat44@example.com$837.00
Failedcarmella@example.com$721.00
tsx
<Table
  head={["Status", "Email", "Amount"]}
  rows={[
    ["Success", "ken99@example.com", "$316.00"],
    ["Success", "abe45@example.com", "$242.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

Terminal
$ bext ui add table

Usage

tsx
import { Table } from "@bext-stack/ui/primitives"

// Raccourci
<Table
  head={["Status", "Email", "Amount"]}
  rows={[
    ["Success", "a@ex.com", "$316"],
    ["Failed", "b@ex.com", "$242"],
  ]}
/>

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.

Try it live Open in play

Edit this example live in the bext playground — it compiles and runs entirely in your browser.

src/app/page.tsx 1 file · react · runs in your browser
The React idiom — same UI, for comparison.