Table

The parts of a real HTML table with the Kit's look: right-aligned numbers with tabular figures, a header that sticks on scroll, selected row, stripes, a totals footer and three densities. Works in a Server Component.

Faturas de outubro. Valores em reais.
FaturaClienteVenceStatusValor
F-2291Clínica Aurora05/10PagaR$ 1.290,00
F-2292Padaria Trigo Bom07/10AbertaR$ 349,90
F-2293Studio Vértice10/10PagaR$ 2.780,50
F-2294Oficina Duarte12/10AtrasadaR$ 89,00
F-2295Escola Passo Certo15/10AbertaR$ 12.400,00
TotalR$ 16.909,40

Settings

Densidade
Toggles

Examples

Sticky header on scroll

ProdutoSKUQtd.Preço
Camiseta básica PCB-P-PRT142R$ 39,90
Camiseta básica MCB-M-PRT88R$ 39,90
Camiseta básica GCB-G-PRT12R$ 39,90
Moletom canguru MMC-M-CNZ31R$ 159,00
Moletom canguru GMC-G-CNZ4R$ 159,00
Boné aba retaBN-UN-PRT57R$ 74,50
Meia cano alto (3 pares)MA-UN-BRC210R$ 29,90
Ecobag lona cruaEB-UN-CRU76R$ 24,00
Caneca esmaltadaCE-UN-BRC23R$ 49,00
Garrafa térmica 500 mlGT-UN-PRT9R$ 119,90

Compare plans (row heading)

O que cada plano inclui
RecursoAvulsoAnualEquipe
Designs1TodosTodos
Pessoas11Até 5
Atualizações6 meses12 meses12 meses
PreçoR$ 49R$ 297R$ 890

Compact and striped (log)

HoraEventoms
14:02:11POST /api/pedidos182
14:02:09GET /api/produtos41
14:01:58POST /api/login312
14:01:44GET /api/produtos/8827
14:01:30PATCH /api/pedidos/51201.204

Installation

The command creates components/ui/table.tsx in your project and installs the theme with it. The file is yours: edit it as you like.

npx @ravox-ui/cli add table

Props

PropTypeDefaultDescription
density"compact" | "normal" | "relaxed""normal"Spacing of all cells at once: 32, 44 or 56px of height per row.
stickyHeaderbooleanfalseThe header sticks to the top while the body scrolls. Use with maxHeight.
maxHeightnumber | string—Maximum height of the frame (320, "60vh"). Past that, it scrolls; the frame enters the Tab order so it can be scrolled by keyboard.
stripedbooleanfalseAlternating background on the body rows, for wide tables.
labelstring—Name of the scroll area for screen readers (when the table scrolls).
wrapperClassNamestring—Classes for the bordered frame; className goes on the <table>.
TableHead · numericbooleanfalseOn the <th>: right-aligns the title of a number column. scope="col" is already set; use scope="row" on a row heading.
TableCell · numericbooleanfalseOn the <td>: right-aligned, with tabular-nums (decimal places line up one below the other).
TableRow · selectedbooleanfalsePaints the row as selected. The checkbox inside it is what announces the selection.
TableCaptionComponentProps<"caption">—The <caption>: the name of the table, below it. With className="sr-only" it is for screen readers only.
TableHeader · TableBody · TableFooterComponentProps<"thead" | "tbody" | "tfoot">—The sections of the table. The footer gets a light background and medium weight (totals).

More in Data