Skip to main content
Neural UIv2.1.0Documentation
View v1

FilterBuilder

Build nested filter conditions for data you already display.

Category
Data and hierarchy
Import
@neural-ui/core/filter-builder
Selector
neu-filter-builder
import { NeuFilterBuilderComponent } from '@neural-ui/core/filter-builder';

Overview

FilterBuilder combines criteria into a typed expression. The application uses that expression to filter a local table or send a query to a service.

Filter a table

Change the priority range or add a group to see which incidents still match. The table uses the last valid expression.

Filter a table
Filter incidents

Two bounds separated by a comma. E.g. 2, 5

Team incidents

Filtered results

4 rows; page 1; 0 selected; sort: none
Incident
Priority
Status
Team
Password reset 2 Open Support
Invoice export 3 Resolved Operations
Search results 4 Open Product
Email notifications 5 Open Product
View applied expression
{
  "kind": "group",
  "operator": "and",
  "children": [
    {
      "kind": "condition",
      "field": "priority",
      "rule": "between",
      "value": [
        2,
        5
      ]
    }
  ]
}

Configurator

Compare immediate updates with applying the expression explicitly. Read only preserves the expression for inspection.

Configurator

Live preview

Filters

Two bounds separated by a comma. E.g. 2, 5

{ "kind": "group", "operator": "and", "children": [ { "kind": "condition", "field": "priority", "rule": "between", "value": [ 2, 5 ] } ] }
template.html
<neu-filter-builder [fields]="fields()" [value]="value()" [commit]="commit()" [readonly]="readonly()" (valueChange)="value.set($event)" />

Custom value editor

Replace the free-text editor with a Neural Select. Pass the chosen status back through the template context and watch the applied expression change.

Custom value editor
Filters
{
  "kind": "group",
  "operator": "and",
  "children": [
    {
      "kind": "condition",
      "field": "status",
      "rule": "equals",
      "value": "open"
    }
  ]
}

State and events

Provide fields and the applied value. Accept valueChange to replace the expression.

Accessibility and keyboard

The examples use visible labels and follow the focus order of the live controls.

Key
Action
Tab Move among group controls, conditions and actions.
Enter / Space Open a selector or activate the focused button.
Escape Close the open selector.

API

Configure fields and labels, control the expression, and decide when valid edits apply.

Inputs

Configure the component with [property]="value". Your application supplies these values; the component does not replace the state you pass in.

Name
Type
Default
Template binding
Description
commit"explicit" | "immediate"'explicit'[commit]Choose whether valid changes apply immediately or via the apply button.
editorTemplateRef<NeuFilterBuilderEditorContext<F>> | nullnull[editor]Template for a custom condition editor.
fieldsreadonly NeuFilterBuilderField<F>[]Required[fields]Available field definitions and their supported rules.
labelsPartial<NeuFilterBuilderLabels>{}[labels]Override the builderโ€™s localized labels and messages.
readonlybooleanfalse[readonly]Keep the expression visible and prevent editing.
valueNeuFilterExpression<F> | nullnull[value]Currently applied filter expression.

Outputs

Listen to an event with (event)="handler($event)". The table explains the data your handler receives and how to use it.

Name
Payload
Template binding
Description
valueChangeNeuFilterExpression<F> | null(valueChange)="onValueChange($event)"Proposes the next valid expression, or null when cleared.

Templates

ng-content projects content into the component. TemplateRef inputs receive a template; ng-template directives identify templates with a typed context. A directive shared by an entrypoint is not necessarily a slot of this component.

Name
Mechanism
Contract
editor TemplateRef inputTemplateRef<NeuFilterBuilderEditorContext<F>> | null

Usage example

Content between the button tags is projected content. You can supply text, an icon component or an SVG; the Icons section demonstrates these variants. For iconOnly, omit visible text and provide ariaLabel: projected content is not automatically removed.

Customize content
Filters
{
  "kind": "group",
  "operator": "and",
  "children": [
    {
      "kind": "condition",
      "field": "status",
      "rule": "equals",
      "value": "open"
    }
  ]
}

Public Types

Open a type to inspect its definition and interface fields.

Theming

The builder uses the existing Neural form controls. Apply the application theme to keep conditions and table controls visually consistent.

Specific tokens

This component uses shared theme tokens rather than dedicated component hooks.

Shared tokens used

Override these on a local wrapper to affect this example. An override on :root affects other components that use the same token.

Token
Purpose here
Other impact
Default / fallback
No data