Skip to content
caliper ui docs

Pro

Sortable table

A table with sortable columns, optional selection, loading and empty states.

Pro
pnpm dlx shadcn@latest add @caliper/sortable-table

Q4 portfolio

4 projects · $108,500 budgeted

Select rows to act on them
Projects
Atlas platformMara ChenActive$48,000
Harbour redesignNoor HaddadIn review$21,000
Release notesIvo PetrovActive$6,500
WayfinderSana OkaforPaused$33,000

Sorted by Project, ascending.

Installs components/ui/sortable-table.tsxDepends on lucide-reactMotion honours reduced motion

When to use

Use it for

  • Records people need to sort and select.
  • Admin screens with bulk actions.

Skip it when

  • Thousands of rows; use a virtual table.

Installation

terminal
pnpm dlx shadcn@latest add @caliper/sortable-table

Adds its 4 files to components/ui/, each with its own stylesheet, and installs their packages. Pro installs with your access token, set up once per project. See Pro access. The first part also adds Caliper UI’s tokens; import them once as in Installation.

Usage

Import it from your copy of the source. The example behind the preview comes with the source. It is built from SortableTable and sortRows.

example.tsx
import { SortableTable, sortRows } from "@/components/ui/sortable-table"

The worked example comes with Pro

The 56-line example behind the preview opens here, ready to copy.

  • 626 Pro parts, blocks and page templates, all with source
  • $149 once, with lifetime updates. No renewal
  • A full refund within 14 days if it is not for you
Checking your licence…

API reference

SortableTable

component
PropTypeDefaultDescription
caption *string—
columns *readonly TableColumn<T>[]—
rows *readonly T[]—
getRowId *(row: T) => string—
sortSortState—
defaultSortSortStatenull
onSortChange((sort: SortState) => void)—
selectionreadonly string[]—Selected row ids. Provide with `onSelectionChange` to show checkboxes.
onSelectionChange((ids: string[]) => void)—
selectionActionsReactNode—
loadingboolean—
emptyLabelstring"No results."
classNamestring—

sortRows

component

No props of its own; it accepts the native props of its root element.

Accessibility

It exposes status semantics, with aria-busy, aria-live, aria-label, aria-sort and aria-hidden kept in step with state. Changes that matter are announced through a live region.

No custom key handling; Tab and the native activation keys do the work.

Motion

It checks prefers-reduced-motion itself and settles immediately instead of travelling. Every state is still reachable.

All Tables & trees examples