Filter builder
Build bounded AND/OR expressions from a host-provided field schema.
Interactive example
Loading Polaris web components…
Usage
<FilterBuilder groups={groups} fields={fields} onChange={setGroups} />Properties
| Property | Type | Default | Description |
|---|---|---|---|
| expression | FilterExpression | — | Nested group/rule AST; all, any, none, exactly one. |
| onExpressionChange | (expression)=>void | — | Controlled AST callback. |
| groups | FilterGroup[] | Required | OR groups containing AND rules. |
| fields | FilterField[] | Required | Allowed fields, operators, optional choices and placeholders. |
| onChange | (groups)=>void | Required | Controlled expression update. |
Design & interaction
Use expression for nested AND/OR/NOT/exactly-one logic. groups/onChange remain v1-compatible. Field suggestions allow free manual entry and never replace other rules. Hosts validate depth, allowlists, query semantics and scan budgets on the server. Real box cells and container queries keep long IDs inside narrow drawers. Values stack below field/operator at narrow widths.
Accessibility
Native labeled fields and selects; accessible value-picker buttons and popover; keyboard-usable nested groups.
Open-source source
Available in github.com/Kaupvik/kaupvik-polaris ↗. Host apps supply authentication, native persistence, and read-back state.