Tinyrack

Table

Semantic data tables with responsive overflow, density, and optional row striping.

Contract

AxisValuesDefault
densitycompact, comfortable, spaciouscomfortable
stripedtrue, falsefalse
partsRoot, Caption, Header, Body, Footer, Row, Head, Cellcompound API

Install

pnpm add @tinyrack/ui

Scroll inside the code area to read long lines.

Styles

@import '@tinyrack/ui/components/table.css';

Scroll inside the code area to read long lines.

Imports

import { TRTable } from '@tinyrack/ui/components/table';

Scroll inside the code area to read long lines.

Playground

Usage

Examples

Densities permalink

The same content is shown at every supported density.

Wide-table overflow permalink

Give the horizontal overflow container a visible hint, an accessible name, and a keyboard focus stop when readers need to pan it.

Empty state permalink

Keep empty feedback inside Body as a Row and Cell, and span the visible columns with colSpan.

API

TRTable.Root wraps the native table in an overflow container. Use containerProps to give that region an accessible name and tabIndex={0} when keyboard users need to pan a wide table; containerRef targets the same wrapper while the normal ref still targets <table>.

PartNative element and props
TRTable.Root<table> props plus density, striped, containerClassName, containerProps, and containerRef; ref targets the table.
TRTable.CaptionNative <caption> props; ref targets the caption. Use it for the table's accessible title or description.
TRTable.HeaderNative <thead> props; ref targets the header group.
TRTable.BodyNative <tbody> props; ref targets the body group.
TRTable.FooterNative <tfoot> props; ref targets the footer group.
TRTable.RowNative <tr> props; ref targets the row.
TRTable.HeadNative <th> props; ref targets the header cell. Set scope="col" for column headers and scope="row" for row headers.
TRTable.CellNative <td> props; ref targets the data cell. Supports native attributes such as colSpan, rowSpan, and headers.