Examples
Column types
Declare what a column's values are and the grid picks the operators, filter editor, alignment, comparison and formatting for you.
Live demo
Column types
Filter the date column · Filter the boolean column · Sort the array column
import { ProGrid, type ProColumnDef } from "@/components/pro-grid"
import { formatCurrency, operationOrders, type OperationOrder } from "@/lib/operations-data"
/**
* One column per primitive, so every editor and comparison is reachable.
*
* The boolean and array columns are derived rather than stored: the demo dataset
* has no such fields, and `accessorFn` is how a real projection would surface
* them anyway.
*/
const typedColumns: ProColumnDef<OperationOrder>[] = [
{ accessorKey: "id", header: "Order", size: 110, meta: { label: "Order", type: "string" } },
{
accessorKey: "updatedAt",
header: "Updated",
size: 130,
meta: {
label: "Updated",
type: "date",
formatValue: (value) => new Date(String(value)).toLocaleDateString(),
},
},
{
id: "expedited",
accessorFn: (row) => row.priority === "Critical",
header: "Expedited",
size: 110,
cell: ({ getValue }) => (getValue() ? "Yes" : "No"),
meta: { label: "Expedited", type: "boolean" },
},
{
id: "tags",
accessorFn: (row) => [row.channel, row.priority],
header: "Tags",
size: 190,
cell: ({ getValue }) => (getValue() as string[]).join(", "),
meta: { label: "Tags", type: "array" },
},
{
accessorKey: "revenue",
header: "Revenue",
size: 128,
meta: {
label: "Revenue",
type: "number",
align: "right",
formatValue: (value) => formatCurrency(Number(value)),
},
},
]
const basicDemoRows = operationOrders.slice(0, 18)
export function ColumnTypesDocsDemo() {
return (
<ProGrid<OperationOrder>
columns={typedColumns}
data={basicDemoRows}
getRowId={(row) => row.id}
height={330}
title="One column per type"
toolbar={{ pivot: false, chart: false, refresh: false }}
/>
)
}// The same 18 orders. Two of the columns are projections rather than
// stored fields: `expedited` reads `priority === "Critical"` and `tags`
// pairs `channel` with `priority`, both through `accessorFn`.
/** `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"
},
// …16 more rows
]One column per type
Order
Updated
Expedited
Tags
Revenue
18 rows
Things to try
- Filter the date column
- Filter the boolean column
- Sort the array column
The Code tab above is the component rendering this page; the Data tab is what reaches the grid. The props behind it are explained in Column types.