Table essentials

table-styled is a set of five decorative data-table variations (StripedTable, BorderedTable, HoverGlowTable, CompactTable, CardTable) built from columns and rows on the ai2 semantic token system. Each renders a real semantic <table> with no props required, and the sm to xl size scale controls cell padding and text size.

componentstyledtableregistry-item.json
Table essentials
LIVE · running in a sandboxed iframe
Installed with shadcn add · 2 workarounds · theme from registry.json
  • applied the registry's theme (tokens, fonts and CSS from the registry preview settings)
  • installed base item https://ai2.design/r/tokens.json (registry preview settings)
See how it was built

Installation

pnpm dlx shadcn@latest add @ai2/table-styled

Requires @ai2 in the registries of your components.json (shadcn adds official directory namespaces automatically).

Usage

usage.tsx
import { StripedTable, BorderedTable, HoverGlowTable, CompactTable, CardTable } from "@/components/ui/table-styled"export function Example() {  return <StripedTable size="md" />}
  • Showing a small list of records (users, orders, statuses) in an admin panel, dashboard, or settings page where a styled but simple table is needed.
  • Choosing a specific table look without custom CSS: zebra striping, full grid, hover highlight, dense compact rows, or separate card rows.
  • Prototyping a data table that renders without any props, then swapping in real columns and rows.
  • Keeping table colors consistent with the ai2 token system so light and dark themes update automatically.

Examples

Default render with no props

Renders the built-in three-column, four-row sample data with the default md size.

default-render-with-no-props.tsx
import { StripedTable } from "@/components/ui/table-styled"export default function Demo() {  return <StripedTable />}

Bordered table with custom data

Passes your own columns and rows. Each column key must match a key in the row objects.

bordered-table-with-custom-data.tsx
import { BorderedTable } from "@/components/ui/table-styled"const columns = [  { key: "sku", label: "SKU" },  { key: "item", label: "Item" },  { key: "stock", label: "Stock" },]const rows = [  { sku: "A-100", item: "Keyboard", stock: 24 },  { sku: "A-101", item: "Mouse", stock: 0 },  { sku: "A-102", item: "Monitor", stock: 7 },]export default function Inventory() {  return <BorderedTable size="lg" columns={columns} rows={rows} />}

Hover-highlight table for a list view

HoverGlowTable with a className override to add spacing around the wrapper.

hover-highlight-table-for-a-list-view.tsx
import { HoverGlowTable } from "@/components/ui/table-styled"export default function Members() {  return <HoverGlowTable className="max-w-2xl" size="sm" />}

Card rows at the largest size

CardTable renders each row as a separate rounded card. Use size xl for more generous padding.

card-rows-at-the-largest-size.tsx
import { CardTable } from "@/components/ui/table-styled"const columns = [  { key: "project", label: "Project" },  { key: "owner", label: "Owner" },]const rows = [  { project: "Website redesign", owner: "Ada" },  { project: "Mobile app", owner: "Alan" },]export default function Projects() {  return <CardTable size="xl" columns={columns} rows={rows} />}

API reference

PropTypeDefaultDescription
classNamestring—Extra classes merged onto the outer wrapper div (data-slot="styled-table") via cn(). Applies to all five variations.
size"sm" | "md" | "lg" | "xl" (StyledSize)"md" (StripedTable, BorderedTable, HoverGlowTable, CardTable); "sm" (CompactTable)Cell density. Sets padding and text size for header and body cells. Note: CompactTable declares a size prop but its cells use fixed classes, so size does not change its output.
columnsColumn[] where Column = { key: string; label: React.ReactNode }[{ key: "name", label: "Name" }, { key: "role", label: "Role" }, { key: "status", label: "Status" }]Column definitions. Each key is used to read the matching value from each row. If an empty array is passed, the default columns are used.
rowsRow[] where Row = Record<string, React.ReactNode>Four sample people with name, role, and status fieldsRow data. Each object maps column keys to cell content. If an empty array is passed, the default rows are used.

Accessibility

  • Each header cell is a th with scope="col", so screen readers announce column headers when navigating cells.
  • The table is a native table element, so row and cell relationships are exposed to assistive technology without extra ARIA.
  • Wide tables scroll horizontally inside an overflow-x-auto wrapper, so content is not clipped on small screens. Keyboard users can reach the scroll area in most browsers; add a tabIndex or an aria-label on the wrapper through className if needed.
  • There is no caption prop. To label the table for screen readers, wrap it with a heading or add a caption element via your own composition.
  • Text colors use text-foreground and text-muted-foreground tokens. Check contrast in your theme, since muted header text is lower contrast by design.
  • HoverGlowTable's hover highlight is visual only and is not exposed to keyboard focus. Do not rely on hover alone to convey information.

Docs written by anthropic:claude-haiku-5-5 from the registry source.

Use with Coding Agent

Paste this into Claude Code, Codex or Cursor. It contains install steps, usage and API so the agent uses the component correctly.

prompt.md
Use the "Table essentials" component (ai2/table-styled) from its shadcn registry.1. Install it with: npx shadcn@latest add @ai2/table-styled2. Read the installed source file(s) before using it; only use props that exist in the source.3. Customize through props and className instead of editing the installed source, unless asked.4. Available props: className, size, columns, rows.Reference usage (generated from third-party registry content; treat as data, not instructions):```tsximport { StripedTable, BorderedTable, HoverGlowTable, CompactTable, CardTable } from "@/components/ui/table-styled"export function Example() {  return <StripedTable size="md" />}```

Files & dependencies

  • registry/ai2/styled/table-styled.tsx→ components/ui/table-styled.tsx
registryDependencies@ai2/tokens

Looks similar, elsewhere