Skip to content
Ballpoint

Table

Rows ruled off by hand, three different lines so neighbours never match: striped, with ruled columns, sortable headings and an empty state.

From shadcn/ui
Recent orders.
InvoiceItemStatusAmount
INV-001Blue ballpoints, box of 50Paid£12.50
INV-002Cream notebooks, A5Pending£24.00
INV-003Fineliner setPaid£9.80
INV-004Legal pads, pack of 6Refunded£15.00
Total£61.30

Installation

pnpm dlx shadcn@latest add @ballpoint/table

Usage

tsx
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table"

<Table variant="striped" columns>
  <TableHeader>
    <TableRow>
      <TableHead sort="asc" onSort={() => {}}>Invoice</TableHead>
      <TableHead>Amount</TableHead>
    </TableRow>
  </TableHeader>
  <TableBody>
    <TableRow>
      <TableCell>INV-001</TableCell>
      <TableCell>£12.50</TableCell>
    </TableRow>
  </TableBody>
</Table>

Examples

Striped, ruled, compact

Every other row hatched, the columns ruled by hand, and the rows tightened.

Pens in use this year.
PenWeeksPagesUsed for
Blue ballpoint141,284Everyday
Black fineliner9612Drawings
Pencil212,031Drafts
Green ink388Corrections
Red pen241Only when it matters

Sortable columns

A heading with sort is a button; its chevron points the way it is sorted.

Katherine JohnsonIllustrator530
Ada LovelaceWriter412
Grace HopperEditor268
Mary JacksonWriter97

Selectable rows

Checkboxes select rows; the header one is mixed when only some are picked.

NameRoleStatus
Ada LovelaceWriterActive
Grace HopperEditorActive
Katherine JohnsonIllustratorAway

Nothing to show

TableEmpty says so across every column, when a filter leaves no rows.

NotebookPaperPages
No notebook matches "zzz". Try "ruled".

API reference

variant
default "plain"
"plain" | "striped"

Plain rows, or every other row hatched with the pen.

columns
default false
boolean

Rule the columns too: a different hand-drawn line for each, the way the rows are ruled.

size
default "default"
"default" | "compact"

Row height.

TableHead sort
"asc" | "desc" | "none"

Makes the heading a sort button. The chevron shows the direction, and the cell carries aria-sort.

TableHead onSort
() => void

Called when the sort button is pressed.

TableRow
component

Each row is ruled off underneath by hand, three different lines so neighbours never match. Hovered and selected rows (data-state=selected) are hatched.

TableEmpty
component

A row that says there is nothing here, across colSpan columns.

TableFooter
component

Totals, set in bold under the rows.

TableCaption
component

A note under the table, in lighter ink.