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.jsonTableTableRowTableBodyTableCellTableHead- +6 more
- +3 more
Plan limits
Compose Table, TableCaption, TableHeader, TableBody, TableFooter, TableRow, TableHead and TableCell like HTML.
import { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow } from "@/components/sheenui/table/table";
// Package build (after the first npm release, or a packed tarball): import { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow } from "@sheenui/theme";
export function Example() {
return (
<Table regionLabel="Plan limits table" tableClassName="min-w-64">
<TableCaption>Plan limits</TableCaption>
<TableHeader>
<TableRow>
<TableHead scope="col">Plan</TableHead>
<TableHead scope="col" className="text-end">Seats</TableHead>
<TableHead scope="col" className="text-end">Price</TableHead>
</TableRow>
</TableHeader>
<TableBody>
<TableRow><TableHead scope="row">Free</TableHead><TableCell className="text-end">1</TableCell><TableCell className="text-end">$0</TableCell></TableRow>
<TableRow><TableHead scope="row">Team</TableHead><TableCell className="text-end">10</TableCell><TableCell className="text-end">$29</TableCell></TableRow>
<TableRow><TableHead scope="row">Business</TableHead><TableCell className="text-end">50</TableCell><TableCell className="text-end">$99</TableCell></TableRow>
</TableBody>
<TableFooter>
<TableRow><TableCell colSpan={3} className="text-sheen-fg-muted">Prices per month, billed yearly.</TableCell></TableRow>
</TableFooter>
</Table>
);
}Files to copy
4 folders · 3 files · 2 packages
- From
theme/src/ components/table/hooks/use-latest.tslib/{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
Keyboard
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
Related pages
67 components pages in all: browse them on All components.
By Lokendra Singh Rathore (GitHub, opens in a new tab). Published , updated .