Launch price: lifetime access for $149, $199 after

Data Table

The table for records: sortable headers that report `aria-sort`, a global search, checkboxes with a bulk bar, a menu to hide columns, pagination and an empty state that offers to clear the search.

Data & feedbackFree330 lines · one file

The decision inside it

Empty is not an error

A search with no matches says what was searched and offers 'Show everything', instead of a blank grid that looks broken.

Installation

How you get it

One command. The CLI writes the file into components/ui/ and installs what it needs.

npx shadcn@latest add https://layropro.com/r/data-table

API

“Copy prompt” above puts a full brief on your clipboard — install command, dependencies, props, and the mistakes an assistant usually makes with this component.

Props

Read from the component’s own TypeScript interface when the site is built, so this table cannot drift from the file you install.

PropTypeNotes
datarequiredT[]—
columnsrequiredColumnDef<T, any>[]—
searchPlaceholderstringShow a search box that filters across every column.
selectablebooleanAdds a checkbox column.
bulkActions(rows: T[]) => React.ReactNodeRendered in the toolbar while rows are selected.
onSelectionChange(rows: T[]) => void—
pageSizenumberRows per page. 0 turns paging off. Default 10.
columnTogglebooleanAdds a columns menu for hiding and showing columns.
getRowId(row: T, index: number) => stringStable row ids; defaults to the index.
onRowClick(row: T) => void—
density"compact" | "comfortable"—
emptyReact.ReactNode—
labelstringWhat the rows are, for the table's accessible name: "Invoices".
classNamestring—

Dependencies

npm packages

@tanstack/react-tableclsxlucide-reacttailwind-merge

Layro foundations, installed alongside it

layro-themebuttoncheckboxdropdown-menuinputpaginationstate

Lifetime access

Every component, and everything we ship next.

  • All 65 components, source included
  • The template, and everything released after you buy
  • shadcn CLI or download — React 18/19, Tailwind v4
  • One payment. No subscription.

More in Data & feedback