Row Checkbox

A controlled checkbox for selecting an individual table row.

Connect checked and onCheckedChange to the row selection API.

0 of 4 rows selected

SelectProjectOwner
Website redesignMaya Chen
Mobile applicationNoah Williams
Analytics dashboardAarav Patel
Customer portalSofia Garcia

Installation

pnpm dlx shadcn-svelte@latest add http://sveltekit-prerender/r/row-checkbox.json

Column definition

Use renderComponent inside the cell definition. Keep getRowId stable when rows can reorder.

columns.ts

Render the cell

TanStack Table v9 renders the component configuration with FlexRender.

data-table.svelte

Props

Row checkbox props

NameTypeDefaultDescription
checked
boolean required Whether the row is selected.
onCheckedChange
(checked: boolean) => void required Called when the user changes the checkbox.
aria-label
string "Select row" Accessible label for the checkbox.
class
string undefined Classes forwarded to the underlying checkbox.
...restProps
Checkbox props undefined Forwards supported checkbox props such as disabled, name, and value.