Skip to content

React Table Component

The React table component is a set of plain, styled table primitives for small static tables, in a glass region that scrolls sideways on narrow screens. Use Table for small static tables: a pricing comparison, a spec sheet, a list of keyboard shortcuts or API limits.

npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/table.json
Invoices
InvoiceAmountStatus
INV-204$1200Paid
INV-205$480Paid
INV-206$960Paid
Received$2640
  • Table
  • TableRow
  • TableBody
  • TableCell
  • TableHead
  • +6 more
  • +3 more

Plan limits

Compose Table, TableCaption, TableHeader, TableBody, TableFooter, TableRow, TableHead and TableCell like HTML.

Plan limits
PlanSeatsPrice
Free1$0
Team10$29
Business50$99
Prices per month, billed yearly.

Files to copy

4 folders · 3 files · 2 packages
From theme/src/
  • components/table/
  • hooks/use-latest.ts
  • lib/{cn.ts, form.ts}
  • styles/
shadcn CLI
npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/table.jsonRegistry item: table. The styles need the Tailwind v4 glass UI setup.
Packages
pnpm add clsx tailwind-merge

Props

PropTypeDefaultDescription
Table regionLabelstringthe text of the TableCaptionAccessible name of the scrolling region while the table overflows; defaults to the caption's text.
Table classNamestringNoneExtra classes for the outer glass region that scrolls sideways (the root element).
Table tableClassNamestringNoneExtra classes for the <table> itself. Other table attributes are forwarded.
TableCaption / TableHeader / TableBody / TableFooter / TableRow / TableHead / TableCellelement propsNoneEach is the matching HTML element with glass styling; props and className pass through.

Keyboard

KeysAction
TabFocuses the scrolling region; the arrow keys then scroll it sideways without a mouse.

Accessibility

  • Native table semantics: use TableCaption (or aria-label) to name the table, and scope="col" or scope="row" on TableHead.
  • The glass wrapper is a focusable region named by regionLabel, so a table wider than the screen can be scrolled from the keyboard (WCAG 2.1.1).
  • Row hover tint is decoration only; nothing depends on it. Text keeps 4.5:1 on the glass.

When to use Table

  • Use Table for a pricing comparison, a spec sheet or the rate limits of an API plan: a handful of rows read top to bottom, with no sorting or paging. It renders a real table element, so screen readers announce rows and columns, and on a narrow screen the glass region scrolls sideways.
  • Give every table a TableCaption, visible or sr-only. It names the table, and the scrolling region takes the caption text as its own name unless you pass regionLabel.
  • Use scope="col" or scope="row" on TableHead so a screen reader announces the right header for each cell.
  • Skip it when people need to sort, filter, page or select rows. Use DataTable for that, and Pagination below a long list.
  • Pair it with Badge in cells for status, Tooltip for column help, and ScrollArea only when you need a fixed height.

Frequently asked questions

67 components pages in all: browse them on All components.

By Lokendra Singh Rathore (GitHub, opens in a new tab). Published , updated .