Componentdata1.22 KB gzipZero dependencies
Data Grid
Heavy data grid: sortable columns, pagination, sticky header.
Preview
Live Preview
Installation
Tokens guide →Add to your project via CLI (zero dependencies, code you own):
npx bigbullui add data-gridOr install the full npm package:
npm install bigbulluiUsage
tsx3 lines
import { DataGrid } from "@/components/ui/data-grid"; <DataGrid />Source code
data-grid.tsx + 1 helperZero third-party dependencies (2 local files shown in tabs below).
tsxdata-grid.tsx120 lines
"use client"; import * as React from "react";import { cn } from "./lib/utils"; export interface DataGridColumn<T> { key: string; header: string; /** Custom cell renderer function */ render?: (row: T) => React.ReactNode; /** Enables sorting by this column */ sortable?: boolean;} export interface DataGridProps<T extends Record<string, unknown>> extends React.HTMLAttributes<HTMLDivElement> { columns: DataGridColumn<T>[]; rows: T[]; rowKey?: (row: T) => string;Props
Interactive Prop Playground
Tweak parsed AST props below to generate ready-to-paste JSX.
tsx3 lines
import { DataGrid } from "@/components/ui/data-grid"; <DataGrid />| Prop | Type | Description |
|---|---|---|
| columns | DataGridColumn<T>[] | Column definitions describing headers, cell keys, and sorting. (Default: []) |
| rows | T[] | Configures rows. (Default: []) |
| rowKey | (row: T) => string | Configures row key. |
| pageSize | number | Configures page size. (Default: 8) |
| emptyMessage | string | Configures empty message. (Default: "No records found") |