shadcn’s data table guide, one step at a time, on TanStack Table v9 and drawn by the DS Table: a week of medication deliveries. Each table adds one feature; the last has them all. The guide’s reusable parts (column header, pagination, column toggle) become DS components when a product screen needs them.
Basic table
The DS Table draws what TanStack Table works out; there is no second table component.
Status is a badge with its glyph and word; money is mono and right-aligned.
Short columns (status, copay) shrink to their content; the medication takes the rest.
Every table has a caption.
Medication deliveries this week
Status
Medication
Copay
Delivered
Apixaban 5 mg
$12.00
Delivered
Metoprolol 25 mg
$4.50
On the way
Oxycodone 5 mg
$0.00
Ordered
Cephalexin 500 mg
$8.00
Not delivered
Furosemide 20 mg
$3.25
Delivered
Docusate 100 mg
$0.00
On the way
Wound dressing kit
$15.00
Ordered
Acetaminophen 500 mg
$2.00
Row actions
Row actions open from a button named for its row, such as Actions for Apixaban 5 mg.
Actions start with a verb, in Title Case.
Medication deliveries this week
Status
Medication
Copay
Actions
Delivered
Apixaban 5 mg
$12.00
Delivered
Metoprolol 25 mg
$4.50
On the way
Oxycodone 5 mg
$0.00
Ordered
Cephalexin 500 mg
$8.00
Not delivered
Furosemide 20 mg
$3.25
Delivered
Docusate 100 mg
$0.00
On the way
Wound dressing kit
$15.00
Ordered
Acetaminophen 500 mg
$2.00
Pagination
Five rows per page; Previous and Next are off at either end.
Medication deliveries this week
Status
Medication
Copay
Delivered
Apixaban 5 mg
$12.00
Delivered
Metoprolol 25 mg
$4.50
On the way
Oxycodone 5 mg
$0.00
Ordered
Cephalexin 500 mg
$8.00
Not delivered
Furosemide 20 mg
$3.25
Sorting
Sort from the column header: the icon shows the order, and the header states it to screen readers with aria-sort.
A sortable header reads like the others, bold and black.
Medication deliveries this week
Status
Copay
Delivered
Apixaban 5 mg
$12.00
Delivered
Metoprolol 25 mg
$4.50
On the way
Oxycodone 5 mg
$0.00
Ordered
Cephalexin 500 mg
$8.00
Not delivered
Furosemide 20 mg
$3.25
Delivered
Docusate 100 mg
$0.00
On the way
Wound dressing kit
$15.00
Ordered
Acetaminophen 500 mg
$2.00
Filtering
The filter field carries its label inside the field.
An empty result says what was searched.
Medication deliveries this week
Status
Medication
Copay
Delivered
Apixaban 5 mg
$12.00
Delivered
Metoprolol 25 mg
$4.50
On the way
Oxycodone 5 mg
$0.00
Ordered
Cephalexin 500 mg
$8.00
Not delivered
Furosemide 20 mg
$3.25
Delivered
Docusate 100 mg
$0.00
On the way
Wound dressing kit
$15.00
Ordered
Acetaminophen 500 mg
$2.00
Visibility
The Columns menu hides and shows columns; selection and row actions, where a table has them, always stay.
Medication deliveries this week
Status
Medication
Copay
Delivered
Apixaban 5 mg
$12.00
Delivered
Metoprolol 25 mg
$4.50
On the way
Oxycodone 5 mg
$0.00
Ordered
Cephalexin 500 mg
$8.00
Not delivered
Furosemide 20 mg
$3.25
Delivered
Docusate 100 mg
$0.00
On the way
Wound dressing kit
$15.00
Ordered
Acetaminophen 500 mg
$2.00
Row selection
The header box selects the page and shows a dash when only some rows are selected.
The selected count is announced when it changes.
Medication deliveries this week
Status
Medication
Copay
Delivered
Apixaban 5 mg
$12.00
Delivered
Metoprolol 25 mg
$4.50
On the way
Oxycodone 5 mg
$0.00
Ordered
Cephalexin 500 mg
$8.00
Not delivered
Furosemide 20 mg
$3.25
Delivered
Docusate 100 mg
$0.00
On the way
Wound dressing kit
$15.00
Ordered
Acetaminophen 500 mg
$2.00
Full example
Every step together, as a product screen would use it.