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
checkedbooleanrequiredWhether the row is selected.
onCheckedChange(checked: boolean) => voidrequiredCalled when the user changes the checkbox.
aria-labelstring"Select row"Accessible label for the checkbox.
classstringundefinedClasses forwarded to the underlying checkbox.
...restPropsCheckbox propsundefinedForwards supported checkbox props such as disabled, name, and value.