Features
Layout
Every ProGrid is the same stack — toolbar, optional filter or group panel, a virtualized body, footer. Each region can be resized, relocated, hidden, or replaced with your own content, independently of the rest.
The grid’s regions
Reading top to bottom: an optional toolbar (title, search, and the built-in controls), an optional cross-column filter surface or row-group panel when one applies, the body — the only region that scrolls — and an optional footer status bar. Every region switches on or off independently; hiding one never resizes or repositions another.
Sizing and density
height sets the viewport the body scrolls within — a number of pixels, or a CSS length such as "100%". Pair height="auto" with maxHeight for a card that grows with its data up to a cap, then scrolls.rowHeight sets density and doubles as the row virtualizer’s size estimate, and fitColumns stretches declared column widths to fill any extra room instead of leaving it empty.
<ProGrid
columns={columns}
data={orders}
height={420} // fixed viewport — the body scrolls within it
rowHeight={28} // compact rows; also seeds the row virtualizer's estimate
fitColumns // stretch columns to fill a wider body instead of leaving dead space
/>
// A body that grows with its rows but stops scrolling past a cap:
<ProGrid columns={columns} data={orders} height="auto" maxHeight="70dvh" />Density and column fit
Switch row height, or stretch the five columns to fill the body instead of leaving space to the right.
import { useState } from "react"
import { ProGrid, type ProColumnDef } from "@/components/pro-grid"
import { formatCurrency, operationOrders, type OperationOrder } from "@/lib/operations-data"
function StatusCell({ value }: { value: unknown }) {
const status = String(value)
return <span className={`order-status order-status--${status.toLowerCase().replaceAll(" ", "-")}`}>{status}</span>
}
const baseColumns: ProColumnDef<OperationOrder>[] = [
{ accessorKey: "id", header: "Order", size: 118, meta: { label: "Order", type: "string" } },
{ accessorKey: "customer", header: "Customer", size: 190, meta: { label: "Customer", type: "string" } },
{
accessorKey: "region",
header: "Region",
size: 145,
meta: {
label: "Region",
type: "string", filterVariant: "set",
filterOptions: ["North America", "Europe", "Asia Pacific", "Latin America"],
groupable: true,
pivotable: true,
},
},
{
accessorKey: "status",
header: "Status",
size: 120,
cell: ({ getValue }) => <StatusCell value={getValue()} />,
meta: {
label: "Status",
type: "string", filterVariant: "set",
filterOptions: ["On track", "At risk", "Delayed", "Complete"],
groupable: true,
pivotable: true,
},
},
{
accessorKey: "units",
header: "Units",
size: 88,
meta: { label: "Units", type: "number", align: "right", aggregable: true, defaultAgg: "sum" },
},
{
accessorKey: "revenue",
header: "Revenue",
size: 128,
meta: {
label: "Revenue",
type: "number",
align: "right",
aggregable: true,
defaultAgg: "sum",
formatValue: (value) => formatCurrency(Number(value)),
},
},
]
const layoutDemoRows = operationOrders.slice(0, 40)
const DENSITIES = [
{ label: "Compact", rowHeight: 28 },
{ label: "Default", rowHeight: 34 },
{ label: "Comfortable", rowHeight: 44 },
] as const
export function DensityDocsDemo() {
const [rowHeight, setRowHeight] = useState<number>(34)
const [fitColumns, setFitColumns] = useState(false)
return (
<div className="space-y-3">
<div className="flex flex-wrap items-center gap-3 text-sm">
<span className="text-muted-foreground">Density</span>
<div className="flex overflow-hidden rounded-md border border-border">
{DENSITIES.map((d) => (
<button
key={d.label}
onClick={() => setRowHeight(d.rowHeight)}
aria-pressed={rowHeight === d.rowHeight}
className={`px-3 py-1 text-xs ${
rowHeight === d.rowHeight ? "bg-primary text-primary-foreground" : "hover:bg-muted"
}`}
>
{d.label}
</button>
))}
</div>
<label className="flex cursor-pointer items-center gap-1.5 text-xs text-muted-foreground">
<input
type="checkbox"
checked={fitColumns}
onChange={(e) => setFitColumns(e.target.checked)}
/>
Fit columns to width
</label>
</div>
<ProGrid<OperationOrder>
columns={baseColumns.slice(0, 5)}
data={layoutDemoRows}
getRowId={(row) => row.id}
height={320}
rowHeight={rowHeight}
fitColumns={fitColumns}
title="Orders"
toolbar={{ pivot: false, chart: false }}
/>
</div>
)
}// 40 flat orders — the same grid at every density.
// `rowHeight` also seeds the row virtualizer's row-size estimate.
/** `Cancelled` is never generated below; the billing demo marks its own. */
type OrderStatus = "On track" | "At risk" | "Delayed" | "Complete" | "Cancelled"
interface OperationOrder extends Record<string, unknown> {
id: string
customer: string
channel: "Direct" | "Marketplace" | "Partner"
region: "North America" | "Europe" | "Asia Pacific" | "Latin America"
owner: string
status: OrderStatus
priority: "Critical" | "High" | "Normal"
units: number
revenue: number
margin: number
slaHours: number
updatedAt: string
}
const rows: OperationOrder[] = [
{
"id": "ORD-10482",
"customer": "Keystone Foods",
"channel": "Direct",
"region": "North America",
"owner": "Theo Martins",
"status": "Complete",
"priority": "Normal",
"units": 18,
"revenue": 1850,
"margin": 12,
"slaHours": 2,
"updatedAt": "2026-08-01T08:00:00.000Z"
},
{
"id": "ORD-10483",
"customer": "Atlas Manufacturing",
"channel": "Partner",
"region": "North America",
"owner": "Jon Bell",
"status": "Delayed",
"priority": "Critical",
"units": 55,
"revenue": 9769,
"margin": 25,
"slaHours": 7,
"updatedAt": "2026-08-02T09:00:00.000Z"
},
// …38 more rows
]Orders
Footer and pagination placement
Pagination controls default to the footer, but they can move into the toolbar instead — useful once the footer is hidden entirely, or when the page controls read more like a toolbar action than a status line. footer={false} removes the row-count bar regardless of where pagination lives.
// No pagination at all — every row renders, the body just scrolls.
<ProGrid columns={columns} data={orders} pagination={false} />
// Page controls in the footer (the default placement).
<ProGrid columns={columns} data={orders} pagination={{ pageSize: 25 }} />
// Move them into the toolbar instead, and drop the footer entirely.
<ProGrid
columns={columns}
data={orders}
pagination={{ pageSize: 25, placement: "toolbar" }}
footer={false}
/>Footer and pagination
Move pagination between the footer and the toolbar, or drop the footer and page controls both.
import { useState } from "react"
import { ProGrid, type ProColumnDef } from "@/components/pro-grid"
import { formatCurrency, operationOrders, type OperationOrder } from "@/lib/operations-data"
function StatusCell({ value }: { value: unknown }) {
const status = String(value)
return <span className={`order-status order-status--${status.toLowerCase().replaceAll(" ", "-")}`}>{status}</span>
}
const baseColumns: ProColumnDef<OperationOrder>[] = [
{ accessorKey: "id", header: "Order", size: 118, meta: { label: "Order", type: "string" } },
{ accessorKey: "customer", header: "Customer", size: 190, meta: { label: "Customer", type: "string" } },
{
accessorKey: "region",
header: "Region",
size: 145,
meta: {
label: "Region",
type: "string", filterVariant: "set",
filterOptions: ["North America", "Europe", "Asia Pacific", "Latin America"],
groupable: true,
pivotable: true,
},
},
{
accessorKey: "status",
header: "Status",
size: 120,
cell: ({ getValue }) => <StatusCell value={getValue()} />,
meta: {
label: "Status",
type: "string", filterVariant: "set",
filterOptions: ["On track", "At risk", "Delayed", "Complete"],
groupable: true,
pivotable: true,
},
},
{
accessorKey: "units",
header: "Units",
size: 88,
meta: { label: "Units", type: "number", align: "right", aggregable: true, defaultAgg: "sum" },
},
{
accessorKey: "revenue",
header: "Revenue",
size: 128,
meta: {
label: "Revenue",
type: "number",
align: "right",
aggregable: true,
defaultAgg: "sum",
formatValue: (value) => formatCurrency(Number(value)),
},
},
]
const layoutDemoRows = operationOrders.slice(0, 40)
const PAGINATION_MODES = ["footer", "toolbar", "off"] as const
type PaginationMode = (typeof PAGINATION_MODES)[number]
export function RegionsDocsDemo() {
const [footer, setFooter] = useState(true)
const [paginationMode, setPaginationMode] = useState<PaginationMode>("footer")
const pagination =
paginationMode === "off" ? false : { pageSize: 8, placement: paginationMode as "footer" | "toolbar" }
return (
<div className="space-y-3">
<div className="flex flex-wrap items-center gap-3 text-sm">
<span className="text-muted-foreground">Pagination</span>
<div className="flex overflow-hidden rounded-md border border-border">
{PAGINATION_MODES.map((mode) => (
<button
key={mode}
onClick={() => setPaginationMode(mode)}
aria-pressed={paginationMode === mode}
className={`px-3 py-1 text-xs capitalize ${
paginationMode === mode ? "bg-primary text-primary-foreground" : "hover:bg-muted"
}`}
>
{mode}
</button>
))}
</div>
<label className="flex cursor-pointer items-center gap-1.5 text-xs text-muted-foreground">
<input type="checkbox" checked={footer} onChange={(e) => setFooter(e.target.checked)} />
Footer
</label>
</div>
<ProGrid<OperationOrder>
columns={baseColumns.slice(0, 5)}
data={layoutDemoRows}
getRowId={(row) => row.id}
height={320}
footer={footer}
pagination={pagination}
title="Orders"
toolbar={{ pivot: false, chart: false }}
/>
</div>
)
}// 40 flat orders. Only `footer` and `pagination.placement`
// change between the three toggle states — the rows never do.
/** `Cancelled` is never generated below; the billing demo marks its own. */
type OrderStatus = "On track" | "At risk" | "Delayed" | "Complete" | "Cancelled"
interface OperationOrder extends Record<string, unknown> {
id: string
customer: string
channel: "Direct" | "Marketplace" | "Partner"
region: "North America" | "Europe" | "Asia Pacific" | "Latin America"
owner: string
status: OrderStatus
priority: "Critical" | "High" | "Normal"
units: number
revenue: number
margin: number
slaHours: number
updatedAt: string
}
const rows: OperationOrder[] = [
{
"id": "ORD-10482",
"customer": "Keystone Foods",
"channel": "Direct",
"region": "North America",
"owner": "Theo Martins",
"status": "Complete",
"priority": "Normal",
"units": 18,
"revenue": 1850,
"margin": 12,
"slaHours": 2,
"updatedAt": "2026-08-01T08:00:00.000Z"
},
{
"id": "ORD-10483",
"customer": "Atlas Manufacturing",
"channel": "Partner",
"region": "North America",
"owner": "Jon Bell",
"status": "Delayed",
"priority": "Critical",
"units": 55,
"revenue": 9769,
"margin": 25,
"slaHours": 7,
"updatedAt": "2026-08-02T09:00:00.000Z"
},
// …38 more rows
]Orders
Trimming the toolbar
Each built-in toolbar control — quick filter, filters, header filters, refresh, expand, groups, pivot, chart, columns — takes true for its own button, false to remove it, or "menu" to fold it into the toolbar’s settings dropdown instead of dropping it outright. That’s how a busy toolbar shrinks to just the controls a reader reaches for daily — search, refresh, maybe groups — while pivot, chart, columns, and the rest stay one click away in the gear rather than gone.
The dropdown itself only appears once a control is folded into it, and it can be removed outright with toolbar={ settings: false }. That never costs a control its functionality: anything still set to "menu" falls back to its own button instead of disappearing, so hiding the gear can only add buttons back, never take a feature away.
// Every built-in toolbar control takes three values: a button (true, the
// default), folded into the settings dropdown ("menu"), or gone (false).
<ProGrid
columns={columns}
data={orders}
toolbar={{
groups: "menu",
pivot: "menu",
chart: "menu",
columns: "menu",
headerFilters: "menu", // the default — most grids never need this as a button
refresh: false,
}}
/>
// The gear itself is the one exception — settings is a plain boolean, since a
// menu has nowhere else to fold into. Turning it off doesn't drop the controls
// above: each "menu" falls back to its own button instead.
<ProGrid columns={columns} data={orders} toolbar={{ pivot: "menu", settings: false }} />See the full control list for every key and its default.
Button, menu, or off
Switch any control between its own button, the settings dropdown, and gone, or turn the dropdown off entirely and watch its contents fall back to buttons.
import { useState } from "react"
import { ProGrid, type ProColumnDef, type ToolbarConfig, type ToolbarControl } from "@/components/pro-grid"
import { formatCurrency, operationOrders, type OperationOrder } from "@/lib/operations-data"
function StatusCell({ value }: { value: unknown }) {
const status = String(value)
return <span className={`order-status order-status--${status.toLowerCase().replaceAll(" ", "-")}`}>{status}</span>
}
const baseColumns: ProColumnDef<OperationOrder>[] = [
{ accessorKey: "id", header: "Order", size: 118, meta: { label: "Order", type: "string" } },
{ accessorKey: "customer", header: "Customer", size: 190, meta: { label: "Customer", type: "string" } },
{
accessorKey: "region",
header: "Region",
size: 145,
meta: {
label: "Region",
type: "string", filterVariant: "set",
filterOptions: ["North America", "Europe", "Asia Pacific", "Latin America"],
groupable: true,
pivotable: true,
},
},
{
accessorKey: "status",
header: "Status",
size: 120,
cell: ({ getValue }) => <StatusCell value={getValue()} />,
meta: {
label: "Status",
type: "string", filterVariant: "set",
filterOptions: ["On track", "At risk", "Delayed", "Complete"],
groupable: true,
pivotable: true,
},
},
{
accessorKey: "units",
header: "Units",
size: 88,
meta: { label: "Units", type: "number", align: "right", aggregable: true, defaultAgg: "sum" },
},
{
accessorKey: "revenue",
header: "Revenue",
size: 128,
meta: {
label: "Revenue",
type: "number",
align: "right",
aggregable: true,
defaultAgg: "sum",
formatValue: (value) => formatCurrency(Number(value)),
},
},
]
const layoutDemoRows = operationOrders.slice(0, 40)
const TOOLBAR_DEMO_KEYS = [
"headerFilters",
"refresh",
"expand",
"groups",
"pivot",
"chart",
"columns",
] as const satisfies readonly (keyof ToolbarConfig)[]
type ToolbarDemoKey = (typeof TOOLBAR_DEMO_KEYS)[number]
const TOOLBAR_DEMO_LABELS: Record<ToolbarDemoKey, string> = {
headerFilters: "Header filters",
refresh: "Refresh",
expand: "Expand",
groups: "Groups",
pivot: "Pivot",
chart: "Chart",
columns: "Columns",
}
const TOOLBAR_PLACEMENTS: { value: ToolbarControl; label: string }[] = [
{ value: true, label: "Button" },
{ value: "menu", label: "Menu" },
{ value: false, label: "Off" },
]
const DEFAULT_TOOLBAR_DEMO_CONFIG: Record<ToolbarDemoKey, ToolbarControl> = {
headerFilters: "menu",
refresh: true,
expand: true,
groups: true,
pivot: true,
chart: true,
columns: true,
}
export function ToolbarControlsDocsDemo() {
const [config, setConfig] = useState(DEFAULT_TOOLBAR_DEMO_CONFIG)
const [settings, setSettings] = useState(true)
return (
<div className="space-y-3">
<div className="flex flex-wrap items-center gap-3 border-b border-border pb-3 text-sm">
<label className="flex cursor-pointer items-center gap-1.5 font-medium">
<input
type="checkbox"
checked={settings}
onChange={(e) => setSettings(e.target.checked)}
/>
Settings dropdown
</label>
{!settings && (
<span className="text-xs text-muted-foreground">
Off — every control below set to "Menu" falls back to its own button instead
of disappearing.
</span>
)}
</div>
<div className="grid grid-cols-1 gap-x-6 gap-y-2 sm:grid-cols-2 lg:grid-cols-3">
{TOOLBAR_DEMO_KEYS.map((key) => (
<div key={key} className="flex items-center gap-2 text-sm">
<span className="w-28 shrink-0 text-muted-foreground">{TOOLBAR_DEMO_LABELS[key]}</span>
<div className="flex overflow-hidden rounded-md border border-border">
{TOOLBAR_PLACEMENTS.map((p) => (
<button
key={String(p.value)}
onClick={() => setConfig((c) => ({ ...c, [key]: p.value }))}
aria-pressed={config[key] === p.value}
className={`px-2 py-1 text-xs ${
config[key] === p.value ? "bg-primary text-primary-foreground" : "hover:bg-muted"
}`}
>
{p.label}
</button>
))}
</div>
</div>
))}
</div>
<ProGrid<OperationOrder>
columns={baseColumns}
data={layoutDemoRows}
getRowId={(row) => row.id}
height={340}
initialGrouping={["region"]}
title="Orders"
toolbar={{ ...config, settings }}
/>
</div>
)
}// 40 flat orders, grouped by region so `expand` and `groups`
// both have something to act on. Every toggle below writes straight into
// the `toolbar` prop — nothing else about the grid changes. Turning the
// settings dropdown off falls any control still set to "menu" back to a
// button rather than dropping it.
/** `Cancelled` is never generated below; the billing demo marks its own. */
type OrderStatus = "On track" | "At risk" | "Delayed" | "Complete" | "Cancelled"
interface OperationOrder extends Record<string, unknown> {
id: string
customer: string
channel: "Direct" | "Marketplace" | "Partner"
region: "North America" | "Europe" | "Asia Pacific" | "Latin America"
owner: string
status: OrderStatus
priority: "Critical" | "High" | "Normal"
units: number
revenue: number
margin: number
slaHours: number
updatedAt: string
}
const rows: OperationOrder[] = [
{
"id": "ORD-10482",
"customer": "Keystone Foods",
"channel": "Direct",
"region": "North America",
"owner": "Theo Martins",
"status": "Complete",
"priority": "Normal",
"units": 18,
"revenue": 1850,
"margin": 12,
"slaHours": 2,
"updatedAt": "2026-08-01T08:00:00.000Z"
},
{
"id": "ORD-10483",
"customer": "Atlas Manufacturing",
"channel": "Partner",
"region": "North America",
"owner": "Jon Bell",
"status": "Delayed",
"priority": "Critical",
"units": 55,
"revenue": 9769,
"margin": 25,
"slaHours": 7,
"updatedAt": "2026-08-02T09:00:00.000Z"
},
// …38 more rows
]Orders
Custom content in the toolbar and footer
renderToolbar, renderToolbarEnd, and renderFooter each add content alongside the built-ins rather than instead of them — before, after, and inside the footer’s status bar, respectively. All three receive the same GridSlotContext: the live TanStack table instance, the current rowCount and selectedCount, whether a server fetch is loading, and a refresh callback — enough to build an export button, a live summary, or a custom action without a dedicated prop for each.
function OrdersGrid() {
return (
<ProGrid<Order>
columns={columns}
data={orders}
title="Orders"
renderToolbar={(ctx) => <Badge>{ctx.rowCount} matching</Badge>}
renderToolbarEnd={(ctx) => <Button onClick={() => exportRows(ctx.table)}>Export</Button>}
renderFooter={(ctx) => <span>Avg margin {averageMargin(ctx.table)}%</span>}
/>
)
}Toolbar and footer slots
A live match count next to the title, an export button after the built-ins, and an aggregate in the footer — all reading the same slot context.
import { ProGrid, type ProColumnDef } from "@/components/pro-grid"
import { formatCurrency, operationOrders, type OperationOrder } from "@/lib/operations-data"
function StatusCell({ value }: { value: unknown }) {
const status = String(value)
return <span className={`order-status order-status--${status.toLowerCase().replaceAll(" ", "-")}`}>{status}</span>
}
const baseColumns: ProColumnDef<OperationOrder>[] = [
{ accessorKey: "id", header: "Order", size: 118, meta: { label: "Order", type: "string" } },
{ accessorKey: "customer", header: "Customer", size: 190, meta: { label: "Customer", type: "string" } },
{
accessorKey: "region",
header: "Region",
size: 145,
meta: {
label: "Region",
type: "string", filterVariant: "set",
filterOptions: ["North America", "Europe", "Asia Pacific", "Latin America"],
groupable: true,
pivotable: true,
},
},
{
accessorKey: "status",
header: "Status",
size: 120,
cell: ({ getValue }) => <StatusCell value={getValue()} />,
meta: {
label: "Status",
type: "string", filterVariant: "set",
filterOptions: ["On track", "At risk", "Delayed", "Complete"],
groupable: true,
pivotable: true,
},
},
{
accessorKey: "units",
header: "Units",
size: 88,
meta: { label: "Units", type: "number", align: "right", aggregable: true, defaultAgg: "sum" },
},
{
accessorKey: "revenue",
header: "Revenue",
size: 128,
meta: {
label: "Revenue",
type: "number",
align: "right",
aggregable: true,
defaultAgg: "sum",
formatValue: (value) => formatCurrency(Number(value)),
},
},
]
const layoutDemoRows = operationOrders.slice(0, 40)
export function SlotsDocsDemo() {
return (
<ProGrid<OperationOrder>
columns={baseColumns.slice(0, 5)}
data={layoutDemoRows}
getRowId={(row) => row.id}
height={320}
title="Orders"
toolbar={{ pivot: false, chart: false }}
renderToolbar={(ctx) => (
<span className="rounded-full bg-primary/10 px-2 py-0.5 text-xs font-medium text-primary tabular-nums">
{ctx.rowCount} matching
</span>
)}
renderToolbarEnd={(ctx) => (
<button
className="h-8 rounded-md border border-border px-3 text-xs hover:bg-muted"
onClick={() => alert(`Exporting ${ctx.rowCount} rows…`)}
>
Export
</button>
)}
renderFooter={(ctx) => {
const rows = ctx.table.getFilteredRowModel().flatRows.map((r) => r.original)
const avg = rows.length ? rows.reduce((sum, r) => sum + r.margin, 0) / rows.length : 0
return <span className="tabular-nums">Avg margin {avg.toFixed(1)}%</span>
}}
/>
)
}// 40 flat orders. The three slots below all receive the same
// `GridSlotContext`, so a custom action can read `rowCount`, `table`,
// `selectedCount`, or call `refresh` without another prop for each.
/** `Cancelled` is never generated below; the billing demo marks its own. */
type OrderStatus = "On track" | "At risk" | "Delayed" | "Complete" | "Cancelled"
interface OperationOrder extends Record<string, unknown> {
id: string
customer: string
channel: "Direct" | "Marketplace" | "Partner"
region: "North America" | "Europe" | "Asia Pacific" | "Latin America"
owner: string
status: OrderStatus
priority: "Critical" | "High" | "Normal"
units: number
revenue: number
margin: number
slaHours: number
updatedAt: string
}
const rows: OperationOrder[] = [
{
"id": "ORD-10482",
"customer": "Keystone Foods",
"channel": "Direct",
"region": "North America",
"owner": "Theo Martins",
"status": "Complete",
"priority": "Normal",
"units": 18,
"revenue": 1850,
"margin": 12,
"slaHours": 2,
"updatedAt": "2026-08-01T08:00:00.000Z"
},
{
"id": "ORD-10483",
"customer": "Atlas Manufacturing",
"channel": "Partner",
"region": "North America",
"owner": "Jon Bell",
"status": "Delayed",
"priority": "Critical",
"units": 55,
"revenue": 9769,
"margin": 25,
"slaHours": 7,
"updatedAt": "2026-08-02T09:00:00.000Z"
},
// …38 more rows
]