Available · v0.2.1

Filter builder

Build bounded AND/OR expressions from a host-provided field schema.

Interactive example

Loading Polaris components…

Usage

<FilterBuilder groups={groups} fields={fields} onChange={setGroups} />

Properties

PropertyTypeDefaultDescription
expressionFilterExpression—Nested group/rule AST; all, any, none, exactly one.
onExpressionChange(expression)=>void—Controlled AST callback.
groupsFilterGroup[]RequiredOR groups containing AND rules.
fieldsFilterField[]RequiredAllowed fields, operators, optional choices and placeholders.
onChange(groups)=>voidRequiredControlled expression update.

Design and 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.

Accessibility

Native labeled fields and selects; accessible value-picker buttons and popover; keyboard-usable nested groups.

Implementation and ownership

Source: Kaupvik Website, packages/polaris. React client component; controlled host data. No API credentials or merchant transport are included. Host applications own authentication, validation, localization, errors and persisted preferences. Graph nodes use native Shopify identities; diagram positions are presentation only.

Tokens and states

Native controls use Shopify attributes and inherit the host’s design system. Kaupvik layout tokens: --kp-surface, --kp-surface-subdued, --kp-ink, --kp-ink-subdued, --kp-border, --kp-accent, --kp-focus, --kp-radius, --kp-space. Override only within the product surface. Loading, error and empty states are distinct; host data is never invented to fill a preview.

Verification

Test keyboard and pointer operation, focus visibility, 375px and desktop layouts, reduced motion and server hydration. Test every product adapter independently before release. QO remains on its reviewed implementation until its own adoption release.

Related product patterns