Features
Filtering
Filter from the column headers, from a bar, a rail or a dialog, or from a UI you build yourself. Every surface edits one model, so they cannot disagree.
Declaring a filter
Filtering follows from the column metadata rather than from a separate configuration. A column gets a filter by declaring type; the operators offered, the editor rendered, and how values are compared all follow from it. A column with notype has no filter, and filterable: false removes one from a column that declares a type for some other reason.
const columns: ProColumnDef<Order>[] = [
// A column gets a filter by declaring what its values are.
{ accessorKey: "customer", header: "Customer", meta: { type: "string" } },
{ accessorKey: "units", header: "Units", meta: { type: "number" } },
{ accessorKey: "placed", header: "Placed", meta: { type: "date" } },
// Options turn a string column into a checkbox list, and let the label the
// reader sees differ from the code the API receives.
{
accessorKey: "status",
header: "Status",
meta: {
type: "string",
filterOptions: [{ value: "N", label: "New" }, "On track", "Delayed"],
},
},
// Declares a type so the chart can read it, but is not filterable.
{ accessorKey: "score", header: "Score", meta: { type: "number", filterable: false } },
]Where the filters live
The funnel in each column header is the baseline, and it is on by default. Thefilters prop adds a second, cross-column surface: a bar of chips above the body, a rail down the left, or a dialog. The toolbar grows a Filters button that toggles it and carries the active count, so a collapsed bar still says the rows are narrowed.
// The header funnels alone — the default.
<ProGrid columns={columns} data={orders} />
// A bar of chips above the body.
<ProGrid columns={columns} data={orders} filters />
// A rail down the left, listing every filterable column.
<ProGrid columns={columns} data={orders} filters={{ placement: "left", width: 280 }} />
// A dialog, opened from the toolbar's Filters button.
<ProGrid columns={columns} data={orders} filters={{ placement: "dialog" }} />
// One surface only: the panel, with the header funnels turned off.
<ProGrid
columns={columns}
data={orders}
filters={{ placement: "left", headerFilters: false, quickFilter: true }}
/>The surfaces do not replace the header funnels — both edit the same state and stay in step. Set headerFilters: false for a grid that should have exactly one place to filter.
Left on, the funnels can still be hidden at a glance: the toolbar’s settings menu carries a Header filters switch, and toolbar={{ headerFilters: true }} promotes it to a button of its own. It only reclaims the room — any filter already set stays set.
One model, four surfaces
Switch the placement and filter from either surface — the header funnel and the panel are always showing the same thing.
import { useState } from "react"
import { ProGrid, type FilterConfig, 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 filterDemoRows = operationOrders.slice(0, 40)
const FILTER_PLACEMENTS = ["top", "left", "dialog", "none"] as const
export function FilteringDocsDemo() {
const [placement, setPlacement] =
useState<NonNullable<FilterConfig["placement"]>>("top")
const [headerFilters, setHeaderFilters] = useState(true)
return (
<div className="space-y-3">
<div className="flex flex-wrap items-center gap-3 text-sm">
<span className="text-muted-foreground">Placement</span>
<div className="flex overflow-hidden rounded-md border border-border">
{FILTER_PLACEMENTS.map((p) => (
<button
key={p}
onClick={() => setPlacement(p)}
aria-pressed={placement === p}
className={`px-3 py-1 text-xs capitalize ${
placement === p ? "bg-primary text-primary-foreground" : "hover:bg-muted"
}`}
>
{p}
</button>
))}
</div>
<label className="flex cursor-pointer items-center gap-1.5 text-xs text-muted-foreground">
<input
type="checkbox"
checked={headerFilters}
onChange={(e) => setHeaderFilters(e.target.checked)}
/>
Header funnels
</label>
</div>
<ProGrid<OperationOrder>
columns={baseColumns}
data={filterDemoRows}
getRowId={(row) => row.id}
height={340}
title="Orders"
filters={{ placement, headerFilters }}
/>
</div>
)
}// 40 flat orders. Filtering is entirely a function of the column
// metadata: a column gets a filter by declaring `type`, and `filterOptions`
// is what turns a string column into a checkbox list.
/** `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
]
// Whatever surface edits it, a column filter is this one shape — the same
// object client mode evaluates and server mode sends.
import type { ColumnType } from "@/components/pro-grid"
type FilterOperator =
// string
| "contains"
| "notContains"
| "startsWith"
| "endsWith"
// string + number + date + boolean
| "equals"
| "notEquals"
// number + date
| "gt"
| "gte"
| "lt"
| "lte"
| "inRange"
// membership — "is any of" for a scalar, "has any of" for an array cell
| "in"
| "notIn"
// array only
| "hasAll"
// date only — `value` is a day count relative to when the filter runs
| "inLast"
| "inNext"
// any type
| "blank"
| "notBlank"
type ConditionJoin = "AND" | "OR"
type FilterCondition = {
operator: FilterOperator
value: unknown
/** Upper bound — `inRange` only. */
valueTo?: unknown
}
/** One column's filter: up to two conditions combined with AND/OR. */
type ColumnFilter = {
id: string
/**
* The column's primitive. Carried on the filter rather than looked up, so a
* filter stays self-describing once it has left the grid — the serialized
* `?filters=` blob and a server-side evaluator both need to know how to
* compare the values, and neither can see the column definitions.
*/
type: ColumnType
conditions: FilterCondition[]
join: ConditionJoin
}
const columnFilters: ColumnFilter[] = [
{
id: "region",
type: "string",
conditions: [{ operator: "in", value: ["Europe", "Asia Pacific"] }],
join: "AND",
},
{
id: "units",
type: "number",
conditions: [{ operator: "gt", value: "120" }],
join: "AND",
},
]Orders
A filter UI of your own
When the filters belong to your page rather than to the grid — a search header, a sidebar that also holds unrelated controls — useGridFilters gives you the model without the markup. It owns the two state slices, resolves every filterable column into a field you can render however you like, and hands back the functions to change them: setQuickFilter, setOperator, setValue,clear and reset, plus inputProps for binding a plain input.
const filters = useGridFilters({ columns })
// `filters.fields` is one resolved entry per filterable column: its label, its
// type, the operators it may use, and its options. Nothing reaches into the grid.
return (
<>
<input value={filters.quickFilter} onChange={(e) => filters.setQuickFilter(e.target.value)} />
{filters.fields.map((field) => (
<label key={field.id}>
{field.label}
<select
value={field.condition.operator}
onChange={(e) => filters.setOperator(field.id, e.target.value)}
>
{field.operators.map((op) => <option key={op} value={op}>{op}</option>)}
</select>
<input {...filters.inputProps(field.id)} />
</label>
))}
<button onClick={filters.reset}>Reset ({filters.activeCount})</button>
<ProGrid columns={columns} data={orders} {...filters.gridProps} />
</>
)Filters outside the grid
The grid mounts no filter surface here. Everything above it is ordinary markup driven by the controller.
import { ProGrid, gridMessages, operatorLabel, useGridFilters, type FilterOperator, 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 filterDemoRows = operationOrders.slice(0, 40)
export function HeadlessFiltersDocsDemo() {
// The grid mounts no filter surface at all; this UI is the only one, and it is
// ordinary markup driven by the controller's own functions.
const filters = useGridFilters({ columns: baseColumns })
return (
<div className="space-y-3">
<div className="flex flex-wrap items-end gap-3 rounded-lg border border-border bg-muted/30 p-3">
<label className="flex flex-col gap-1 text-xs">
<span className="text-muted-foreground">Search</span>
<input
className="h-8 w-44 rounded-md border border-input bg-background px-2 text-sm"
placeholder="Search every column…"
value={filters.quickFilter}
onChange={(e) => filters.setQuickFilter(e.target.value)}
/>
</label>
{filters.fields
.filter((f) => f.id === "region" || f.id === "units")
.map((field) => (
<label key={field.id} className="flex flex-col gap-1 text-xs">
<span className="text-muted-foreground">{field.label}</span>
<div className="flex gap-1">
<select
className="h-8 rounded-md border border-input bg-background px-1 text-xs"
value={field.condition.operator}
onChange={(e) => filters.setOperator(field.id, e.target.value as FilterOperator)}
>
{field.operators.map((op) => (
<option key={op} value={op}>
{operatorLabel(gridMessages("en"), field.type, op)}
</option>
))}
</select>
<input
className="h-8 w-28 rounded-md border border-input bg-background px-2 text-sm"
{...filters.inputProps(field.id)}
/>
</div>
</label>
))}
<button
className="h-8 rounded-md border border-border px-3 text-xs hover:bg-muted"
onClick={filters.reset}
>
Reset ({filters.activeCount})
</button>
</div>
<ProGrid<OperationOrder>
columns={baseColumns}
data={filterDemoRows}
getRowId={(row) => row.id}
height={300}
toolbar={false}
{...filters.gridProps}
/>
</div>
)
}// The same 40 orders. The grid mounts no filter surface here — the
// controls above it are plain markup driven by `useGridFilters`.
/** `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
]
// One resolved entry per filterable column. Everything a custom UI needs to
// render a field is on it, so nothing has to reach into the table.
import { defaultOperator, type ColumnFilter, type FilterCondition, type FilterOperator } from "@/components/pro-grid"
import { type ColumnType, type FilterVariant } from "@/components/pro-grid"
/** A `set` editor's choices, always as value/label pairs. */
type FilterChoice = { value: string; label: string }
/** One filterable column, resolved. */
type GridFilterField = {
id: string
/** `meta.label`, falling back to a string header, falling back to the id. */
label: string
/** Drives the operator menu, its labels, and how values are compared. */
type: ColumnType
/** Which value widget to render. */
editor: FilterVariant
/**
* Operators this field may offer: `meta.filterOperators` when declared, else
* the type's, then narrowed by `serverOperators`.
*/
operators: FilterOperator[]
/** The operator a new condition on this field starts with. */
defaultOperator: FilterOperator
/** Choices for a `set` editor: declared options, else facets from loaded rows. */
options: FilterChoice[]
/** The committed filter, or `undefined` while the column is unfiltered. */
filter?: ColumnFilter
/** First condition — an empty one when unfiltered, so an editor always has one. */
condition: FilterCondition
/** Whether this column currently narrows the rows. */
active: boolean
/** `meta.formatValue`, used to label a chosen date and to summarise a filter. */
formatValue?: (value: unknown) => string
}Server mode
When an API owns paging, the filter model is handed to your data source instead of being evaluated in the browser — the same objects, so the semantics do not change with the mode. Two rules apply to every surface: the join is forced to AND, since a flat filter list cannot express OR, and the operator menu is narrowed to what your dialect declares. Pass serverOperators a list to narrow it exactly.
A set column derives its choices from the loaded rows, which is only the current page once an API pages — so declare filterOptions for those columns. The same applies outside the grid, where there are no rows at all.
From the handle
Filters and the quick filter are both on the grid handle, and both are part ofProGridState, so a saved view restores them alongside the layout.
gridRef.current.setFilters([
{ id: "region", type: "string", conditions: [{ operator: "in", value: ["Europe"] }], join: "AND" },
])
gridRef.current.setQuickFilter("acme")
gridRef.current.clearFilters() // filters and search; the sort stays