Navigated to /docs/ui/components/table

Table

Accessible table primitives with caption, head, rows, and cells.

Preview

A live, theme-aware example rendered with the published component.

Loading preview…

Import

Import the component from its dedicated entry point to keep the dependency and generated bundle explicit.

TSX
tsximport { Table } from "@tavojs/ui/table";

Normal Tavo.js applications load component styles through the Tavo.js UI plugin. If the application manages component CSS manually, also import @tavojs/ui/css/table.

When to use

Use it when

Use Table for structured rows and columns of comparable data.

Choose something else when

Avoid for purely visual grids; use Grid or Stack instead.

Examples

Compound table

TSX
tsximport { Table } from "@tavojs/ui/table";

export function TableExample1() {
  return (
    <>
      <Table.Root caption="Invoices"><Table.Head><Table.Row><Table.HeaderCell>Status</Table.HeaderCell></Table.Row></Table.Head><Table.Body><Table.Row><Table.Cell>Paid</Table.Cell></Table.Row></Table.Body></Table.Root>
    </>
  );
}

Common props and defaults

PropTypeDefaultDescription
classNamestring

Optional class hook applied to the public root element owned by the component.
compactboolean

false

Uses denser row spacing when supported.
captionChild

Accessible table caption when supported.
columnsTableDataColumn[]

Column definitions for Table.Data.
rowsRecord<string, unknown>[]

Rows for Table.Data.

Complete TypeScript API

Import from @tavojs/ui/table. Published exports: Table, TableBody, TableCaption, TableCell, TableCellProps, TableData, TableDataColumn, TableDataProps, TableHead, TableHeaderCell, TableProps, TableRoot, TableRow.

TableProps

PropertyTypeRequiredDescription
childrenChild

No

Inherited children attribute accepted by Table.

classNamestring

No

Optional class hook applied to the public root element owned by the component.

sxSx

No

Inherited sx attribute accepted by Table.

idstring

No

Inherited id attribute accepted by Table.

rolestring

No

Inherited role attribute accepted by Table.

styleRecord<string, unknown>

No

Inherited style attribute accepted by Table.

titlestring

No

Inherited title attribute accepted by Table.

tabIndexnumber

No

Inherited tabIndex attribute accepted by Table.

hiddenboolean

No

Inherited hidden attribute accepted by Table.

disabledboolean

No

Inherited disabled attribute accepted by Table.

onClickTavoEventHandler<MouseEvent>

No

Inherited onClick attribute accepted by Table.

onChangeTavoEventHandler<Event>

No

Inherited onChange attribute accepted by Table.

onInputTavoEventHandler<Event>

No

Inherited onInput attribute accepted by Table.

onKeyDownTavoEventHandler<KeyboardEvent>

No

Inherited onKeyDown attribute accepted by Table.

onFocusTavoEventHandler<FocusEvent>

No

Inherited onFocus attribute accepted by Table.

onBlurTavoEventHandler<FocusEvent>

No

Inherited onBlur attribute accepted by Table.

compactboolean

No

Uses denser row spacing when supported.

TableCellProps

PropertyTypeRequiredDescription
childrenChild

No

Inherited children attribute accepted by Table.

classNamestring

No

Optional class hook applied to the public root element owned by the component.

sxSx

No

Inherited sx attribute accepted by Table.

idstring

No

Inherited id attribute accepted by Table.

rolestring

No

Inherited role attribute accepted by Table.

styleRecord<string, unknown>

No

Inherited style attribute accepted by Table.

titlestring

No

Inherited title attribute accepted by Table.

tabIndexnumber

No

Inherited tabIndex attribute accepted by Table.

hiddenboolean

No

Inherited hidden attribute accepted by Table.

disabledboolean

No

Inherited disabled attribute accepted by Table.

onClickTavoEventHandler<MouseEvent>

No

Inherited onClick attribute accepted by Table.

onChangeTavoEventHandler<Event>

No

Inherited onChange attribute accepted by Table.

onInputTavoEventHandler<Event>

No

Inherited onInput attribute accepted by Table.

onKeyDownTavoEventHandler<KeyboardEvent>

No

Inherited onKeyDown attribute accepted by Table.

onFocusTavoEventHandler<FocusEvent>

No

Inherited onFocus attribute accepted by Table.

onBlurTavoEventHandler<FocusEvent>

No

Inherited onBlur attribute accepted by Table.

numericboolean

No

Inherited numeric attribute accepted by Table.

TableDataProps

PropertyTypeRequiredDescription
childrenChild

No

Inherited children attribute accepted by Table.

classNamestring

No

Optional class hook applied to the public root element owned by the component.

sxSx

No

Inherited sx attribute accepted by Table.

idstring

No

Inherited id attribute accepted by Table.

rolestring

No

Inherited role attribute accepted by Table.

styleRecord<string, unknown>

No

Inherited style attribute accepted by Table.

titlestring

No

Inherited title attribute accepted by Table.

tabIndexnumber

No

Inherited tabIndex attribute accepted by Table.

hiddenboolean

No

Inherited hidden attribute accepted by Table.

disabledboolean

No

Inherited disabled attribute accepted by Table.

onClickTavoEventHandler<MouseEvent>

No

Inherited onClick attribute accepted by Table.

onChangeTavoEventHandler<Event>

No

Inherited onChange attribute accepted by Table.

onInputTavoEventHandler<Event>

No

Inherited onInput attribute accepted by Table.

onKeyDownTavoEventHandler<KeyboardEvent>

No

Inherited onKeyDown attribute accepted by Table.

onFocusTavoEventHandler<FocusEvent>

No

Inherited onFocus attribute accepted by Table.

onBlurTavoEventHandler<FocusEvent>

No

Inherited onBlur attribute accepted by Table.

columnsTableDataColumn<TRow>[]

Yes

Column definitions for Table.Data.

rowsTRow[]

Yes

Rows for Table.Data.

compactboolean

No

Uses denser row spacing when supported.

State ownership and DOM target

ConcernContract
StateNo component state contract is exposed; the application owns the rendered content and surrounding behavior.
DOM targetPublic passthrough props target the component root. Treat nested elements and private class names as implementation details.

Anatomy and related components

Public compound members: Root, Head, Body, Row, HeaderCell, Cell, Data

Limitations

Avoid for purely visual grids; use Grid or Stack instead.

Use only the documented props, entry points, and compound members. Internal DOM nesting and CSS class names can change without becoming part of the public component contract.

Accessibility

Data components should preserve readable order and expose labels for non-textual values.

  • Use captions or nearby headings for tables and charts.

  • Do not rely on color alone for status.

  • Keep values and labels available as text.

Component status

ContractCurrent value
Maturitystable
Categorydata
Component import@tavojs/ui/table
Explicit CSS import@tavojs/ui/css/table
PreviewInteractive preview available on this page