Elements Pro launch: $79 for the first 50 with LAUNCH50 · $129 standard.

Components / Interfaces / DataGrid

DataGrid.

FreeComponent

A typed read-only grid foundation for object collections.

Demo dataResponsive
NameOwnerValue
Project ApolloSarah Chen$12,450
Project ZephyrJames Park$8,230

Installation

pnpm dlx shadcn@latest add https://elements.micropreneur.dev/r/data-grid.json

The shadcn CLI writes the source into your project. Files added:

  • components/elements/data-grid.tsxcomponent
  • components/ui/table.tsxui
  • lib/utils.tslib
Dependenciesclsxtailwind-merge

API

PropTypeDefaultDescription
columns (required)Array<DataGridColumn<T>>—
getRowId (required)(row: T, index: number) => string—
rows (required)T[]—

DataGridColumn

PropTypeDefaultDescription
key (required)keyof T—
label (required)string—
align'left' | 'right'—Right-align the column (typical for figures).
monoboolean—Render cell values in the mono face with tabular numerals.

Accessibility

  • Built on the native Table primitives, with one header cell per column.
  • Rows need a stable id from getRowId so React keeps focus and state across updates.