FilterBar New Alpha Light DOM & Tailwind
Composition-first filter controls for toolbars and table headers — your app owns the active filters and URL state, Nord owns the controls, layout and semantics.
Usage
The filter family is a small set of controls for building the filter toolbar above a list or table. They are composition-first and emit intent only: no component tracks which filters are active. Your app owns the active filters, the URL/query-string state and any data fetching; Nord supplies the controls, the layout and the accessible semantics.
import "@nordhealth/components/lib/FilterBar"
import "@nordhealth/components/lib/FilterInput"
import "@nordhealth/components/lib/FilterDropdown"
import "@nordhealth/components/lib/FilterDateRange"
import "@nordhealth/components/lib/FilterAddButton"
import "@nordhealth/components/lib/FilterResetButton"
Filter Bar is the layout wrapper: it lays its children out in a wrapping flex row with a consistent gap. Drop the filters inside it. Every filter renders the same joined chip — a leading icon, the filter's label, the active selection and a clear or remove affordance, dashed while empty.
The family is made up of:
- Filter Bar — the layout wrapper (flex, wrap, gap). Owns no state.
- Filter Input — a compact search/text field, rendered as a joined label / input / clear pill. Emits
inputandchange. - Filter Dropdown — an options filter: a chip that opens a popout with a (optionally searchable) option list, single or multiple select, grouped or tree options. Emits
change,clear,remove,search-change,load-more,open,close. - Filter Date Range — a date-range filter: a chip that opens a popout with the inline Date Range Picker (presets + calendar + Apply). Emits
change,clear,remove,open,close. - Filter Field — the presentation-only chip primitive. Use it as the
slot="trigger"of your own popout-owning control for a custom filter. Emitsclear,remove. - Filter Add Button — a button that opens a popout of available filters and emits the chosen one. Emits
select. - Filter Reset Button — clears every active filter at once. Emits
reset.
Examples
Filter input
Filter Input is a compact search field, rendered as a joined label / input / clear pill. It emits input as the user types and change when the value is committed. Add clearable to show a clear button. Set label to name it (it has no built-in label otherwise).
Filter input (chip mode)
Set mode="chip" to collapse the input behind a chip button that opens the field in a popout. This is handy in a crowded bar where the search field should not take up a full row.
Filter dropdown
Filter Dropdown is the options filter. It renders the chip and owns the popout, the search field and the option list. Pass options (flat, grouped or tree), set multiple for multi-select, searchable for an in-popout search, and selectAll for a select-all control. Show the active selection by setting value; it fires change when the selection changes, and clear/remove from the chip affordances.
For multi-select, add multiple: each option gains a checkbox, the popout stays open after each pick, and the chip summarises the selection as “selectAll for a select-all control.
Single select
A single-select dropdown picks one option and closes the popout. The chip summarises the chosen label.
Searchable options
Add searchable to filter a long option list from inside the popout.
Grouped options
Group options under headings by passing objects with a heading and their own children.
Tree options
Nest options to build a parent/child tree; selecting a parent toggles its descendants.
Select all
Add select-all to a multi-select dropdown for a single control that toggles every option.
Clearable
Add clearable so the chip exposes a clear affordance that resets the selection.
Removable
Add removable so the trailing affordance removes the whole filter from the bar.
Loading state
Set loading while options are being fetched to show a spinner in the popout.
Async options
Load options lazily when the popout opens, combining loading with a deferred options assignment.
Filter date range
Filter Date Range is the date-range filter. It renders the chip and a popout containing the inline Date Range Picker — presets, the two-month calendar and Apply. Set value to an ISO interval (YYYY-MM-DD/YYYY-MM-DD); it fires change on Apply and formats the range onto the chip for you. Add removable so the trailing affordance removes the whole filter.
Without presets
Add hide-presets to drop the preset list and show only the two-month calendar.
Min and max bounds
Constrain selectable dates with min and max so dates outside the range can't be picked.
Sizes
Filter Date Range comes in small, medium and large to match the surrounding bar.
Filter field (custom chip)
For a filter the dedicated components don't cover, use Filter Field — the presentation-only chip. Set label and a value summary (or active), and listen for clear/remove. Drop it into your own popout-owning control as its slot="trigger": the host opens and positions the popout and sets the ARIA. Here are the empty, active and removable states:
Add button
Filter Add Button opens a popout of available filters. Pass a flat list of options, or group them under headings via objects with a heading and their own options. Selecting an option fires a select event with the option's id and closes the popout — add the corresponding filter in the handler.
Reset button
Filter Reset Button fires a reset event when pressed. Bind disabled to whether any filter is active so it is only enabled when there is something to reset.
A complete bar
Put it together: a search input, an options filter, a date-range filter, an add button and a reset button — a typical data-table toolbar. Your app listens for the events and updates its own active-filter and URL state.
Accessibility
- Filter Input is a control only and has no built-in label. Set
labelfor an accessible name, or wrap it in a Field with a Field Label. - The icon-only clear and remove affordances expose their purpose to assistive technology via visually-hidden labels.
- The Add Button, Filter Dropdown and Filter Date Range triggers use
aria-controls/aria-expandedto associate the trigger with its popout, and the popouts can be dismissed with Escape or by clicking outside. - Filter Field is presentation-only: the popout-owning control it is slotted into wires the
aria-controls/aria-haspopup/aria-expandedrelationship. - The controls emit intent only — make sure the active-filter state your app maintains in response is reflected in the UI (e.g. the chip
valuesummary) so the current filters are announced.
API reference
FilterBar
Filter Bar is a layout wrapper for a row of filter controls. It lays its children out in a wrapping flex row with a consistent gap, so you can drop in Filter Field, Filter Input, Filter Add Button and Filter Reset Button (or any controls) and have them align without extra styling. Like Pagination, it is composition-first: it owns no filter state and emits no events. Your app owns the active filters and any URL or query-string syncing; the filter primitives only emit intent.
<nord-filter-bar></nord-filter-bar>Props
| Property | Attribute | Description | Type | Default |
|---|---|---|---|---|
align | align | The cross-axis alignment of the controls within the bar. | 'start' | 'center' | 'end' | 'center' |
Slots
| Slot name | Description |
|---|---|
Default slot | Default slot for the filter controls. |
CSS Properties
CSS Custom Properties provide more fine grain control over component presentation. We advise utilizing existing properties on the component before using these.
| Property | Description | Default |
|---|---|---|
--n-filter-bar-gap | Controls the spacing between the filter controls. | var(--n-space-s) |
--n-filter-bar-align-items | Controls the cross-axis alignment of the controls. | center |
Parts
This component is made up of the following parts.
Filter Date Range
Filter Date Range is a self-contained date-range **filter**: a chip that opens
a popout containing an inline Date Range Picker
(presets + two-month calendar + Apply). It is the date-range counterpart to
Filter Dropdown and renders the shared filter
chip via Filter Field.
Composition-first: it emits change/clear/remove and leaves the active
filters and any URL/query state to your app.
<nord-filter-date-range></nord-filter-date-range>Props
| Property | Attribute | Description | Type | Default |
|---|---|---|---|---|
label | label | The label naming what this filter targets, shown on the chip. | string | '' |
value | value | The committed range as an ISO-8601 interval string YYYY-MM-DD/YYYY-MM-DD,
or "" for no selection. | string | '' |
min | min | Earliest selectable date (ISO-8601). | string | undefined | — |
max | max | Latest selectable date (ISO-8601). | string | undefined | — |
hidePresets | hide-presets | Hides the built-in preset list, leaving only the calendar. | boolean | false |
firstDayOfWeek | first-day-of-week | First day of the week (0 = Sunday … 6 = Saturday). | number | undefined | — |
today | today | Overrides "today" (ISO-8601), mainly for deterministic tests/demos. | string | undefined | — |
removable | removable | Whether the whole filter can be removed. When true the trailing affordance
is a remove button that fires remove; otherwise it is a clear button. | boolean | false |
clearable | clearable | Shows a clear (✕) button while there is a selection. Defaults to true. | boolean | true |
disabled | disabled | Makes the component disabled. | boolean | false |
size | size | The size of the chip controls. | 's' | 'm' | 'l' | 's' |
name | name | Identifies the filter (e.g. for your app's active-filter state). | string | '' |
open | open | Whether the popout is open. | boolean | false |
Methods
| Method name | Parameters | Description |
|---|---|---|
show() => void | N/A | Open the popout. |
hide() => void | N/A | Close the popout. |
| Event | Detail Type | Description |
|---|---|---|
change | FilterDateRangeChangeEvent | Dispatched when the committed range changes (Apply or clear). |
clear | FilterDateRangeClearEvent | Dispatched when the chip's clear affordance is pressed. |
remove | FilterDateRangeRemoveEvent | Dispatched when the chip's remove affordance is pressed. |
open | NordEvent | Dispatched when the popout is opened. |
close | NordEvent | Dispatched when the popout is closed. |
CSS Properties
CSS Custom Properties provide more fine grain control over component presentation. We advise utilizing existing properties on the component before using these.
| Property | Description | Default |
|---|---|---|
--n-filter-date-range-popout-inline-size | Controls the inline size of the popout content. | — |
Filter Dropdown
Filter Dropdown is a full-featured filter control: a chip trigger that opens a
popout list of options. It owns its selection and tracks value, unlike the
composition-first Filter Field — pass it options
and listen for change. It ports the Provet Cloud filter dropdown.
Options come in three shapes: a flat list ({ value, label }), groups
({ heading, children }) rendered with dividers, and tree-style options
(a selectable option with children) where the parent stays selectable and the
children render indented. Single mode tracks a string value and closes on
select; multiple tracks an array, shows checkboxes and keeps the popout open.
<nord-filter-dropdown></nord-filter-dropdown>Props
| Property | Attribute | Description | Type | Default |
|---|---|---|---|---|
label | label | The label naming what this filter targets, shown on the chip. | string | '' |
name | name | A name identifying what this dropdown filters, for form/identification. | string | '' |
icon | icon | The icon shown on the trigger. | string | 'interface-filter' |
size | size | The size of the trigger and popout. Defaults to s to match the other
filter controls. | FilterDropdownSize | 's' |
optionsValueKey | options-value-key | The key on each option object to read the value from. Defaults to value. | string | 'value' |
optionsLabelKey | options-label-key | The key on each option object to read the label from. Defaults to label. | string | 'label' |
multiple | multiple | Allows selecting more than one option. Selected options show a checkbox indicator and the popout stays open after each selection. | boolean | false |
searchable | searchable | Shows a search input at the top of the popout to filter the options. | boolean | false |
internalSearch | internal-search | Whether options are filtered client-side by their label. Defaults to true.
Set to false for async search: the component then emits search-change and
leaves filtering to the consumer (who updates options). | boolean | true |
selectAll | select-all | Shows a "Select all" control at the top of the popout. Only applies with
multiple. | boolean | false |
clearable | clearable | Shows a clear (✕) button while there is a selection. Pressing it clears the
value (firing clear then change) without removing the dropdown. | boolean | true |
removable | removable | Whether the whole dropdown can be removed. When true the trailing
affordance clears the value and fires remove; the consumer removes the
dropdown from the DOM. Takes precedence over clearable. | boolean | false |
disabled | disabled | Makes the component disabled. This prevents users from being able to interact with it and conveys its inactive state to assistive technologies. | boolean | false |
loading | loading | Shows a spinner in the popout while asynchronous results are loading. Pair
with internal-search="false" for async search. | boolean | false |
open | open | Whether the popout is open. Set it to open or close the popout programmatically. | boolean | false |
noResultsMessage | no-results-message | Message shown when no options match the search. Defaults to "No results.". | string | '' |
labelForUnknown | label-for-unknown | Fallback label shown for a selected value that has no matching option. | string | '' |
Methods
| Method name | Parameters | Description |
|---|---|---|
show() => void | N/A | Open the popout. |
hide() => void | N/A | Close the popout. |
focus(options?: FocusOptions) => void | options: FocusOptions | Focus the trigger button. |
| Event | Detail Type | Description |
|---|---|---|
change | FilterDropdownChangeEvent | Dispatched when the committed selection changes via user interaction. |
search-change | FilterDropdownSearchChangeEvent | Dispatched as the user types when searchable (use with internal-search="false" for async search). |
clear | FilterDropdownClearEvent | Dispatched when the selection is cleared, before change. |
remove | FilterDropdownRemoveEvent | Dispatched when the filter is removed (only when removable). |
load-more | FilterDropdownLoadMoreEvent | Dispatched when the list is scrolled near its end (infinite scroll). |
open | NordEvent | Dispatched when the popout is opened. |
close | NordEvent | Dispatched when the popout is closed. |
CSS Properties
CSS Custom Properties provide more fine grain control over component presentation. We advise utilizing existing properties on the component before using these.
| Property | Description | Default |
|---|---|---|
--n-filter-dropdown-list-inline-size | Controls the inline size, or width, of the popout list. Defaults vary by size. | 250px |
Filter Field
Filter Field is the presentation-only filter **chip**: a joined pill showing a
leading icon, the filter's label, the active selection summary (value) and
a clear or remove affordance, dashed while inactive. It is the shared chip used
across the filter family and the building block for custom filters.
It owns no popout and tracks no value — drop it into a popout-owning control as
its slot="trigger" (the host opens/positions the popout and sets
aria-controls/aria-haspopup/aria-expanded on this element). Show the
active selection with value, reset it in response to clear, and remove the
whole field in response to remove. Your app owns the active filters and any
URL/query state.
<nord-filter-field></nord-filter-field>Props
| Property | Attribute | Description | Type | Default |
|---|---|---|---|---|
label | label | The label naming what this filter targets, shown on the chip. | string | '' |
value | value | A short summary of the active selection (e.g. the selected option's label, or "3 selected"). When set the chip is shown as active and the clear button appears; leave it empty for an inactive filter. The chip does not derive this — set it from your app's state. | string | '' |
active | active | Forces the active (solid) treatment without a value summary, for filters
that are on but have nothing short to show. | boolean | false |
clearable | clearable | Shows a clear (✕) button while the chip is active. Defaults to true. Has no
effect when removable is set. | boolean | true |
icon | icon | The leading icon shown on the chip. | string | 'interface-filter' |
name | name | Identifies the filter (e.g. for your app's active-filter state). | string | '' |
removable | removable | Whether the whole field can be removed. When true the trailing affordance
is a remove button that fires remove; otherwise it is a clear button (shown
only when there is a value) that fires clear. | boolean | false |
disabled | disabled | Makes the component disabled. This prevents users from being able to interact with it and conveys its inactive state to assistive technologies. | boolean | false |
size | size | The size of the chip controls. | 's' | 'm' | 'l' | 's' |
| Event | Detail Type | Description |
|---|---|---|
clear | FilterFieldClearEvent | Dispatched when the clear affordance is pressed. |
remove | FilterFieldRemoveEvent | Dispatched when the remove affordance is pressed. |
Filter Input
Filter Input is a compact search/text field for filtering a collection. It
replaces the small ad-hoc search inputs that sit in toolbars and table
headers. By default it renders inline as a small search field with a leading
search icon; set mode="chip" to collapse it behind a chip button that opens
the input in a popout, which is handy in a crowded Filter Bar.
It emits intent only: input as the user types and change when the value is
committed. Your app owns the active filters and any URL/query state — read the
value from the event target (or bind value) and filter accordingly.
It is a control only, like Combobox: compose it inside
a Field for a visible label, or set label for an
accessible name when used standalone.
<nord-filter-input></nord-filter-input>Props
| Property | Attribute | Description | Type | Default |
|---|---|---|---|---|
mode | mode | How the input is presented.
- inline (default) renders the search field directly.
- chip collapses the field behind a chip button that opens a popout
containing the input. | 'inline' | 'chip' | 'inline' |
open | open | Whether the chip-mode popout is open. Only meaningful with mode="chip". | boolean | false |
size | size | The size of the search control. Defaults to s to match the other filter
controls in a compact filter bar; set m or l to enlarge it. | 's' | 'm' | 'l' | 's' |
clearable | clearable | Whether to show a clear (✕) button while there is a value. Clearing resets
the value to '', then fires input and change. | boolean | false |
placeholder | placeholder | Placeholder text to display within the control. | string | undefined | — |
required | required | Determines whether the control is required or not.
A required control is announced as such to assistive technology and, inside
a <nord-field>, drives the required indicator on the <nord-field-label>.
When using this property you need to also set “novalidate” attribute on a form element to prevent browser from displaying its own validation errors. | boolean | false |
readonly | readonly | Makes the component readonly, so that it is not editable. Readonly differs from disabled in that readonly fields are still focusable and will be submitted with a form. | boolean | false |
disabled | disabled | Makes the component disabled. This prevents users from being able to interact with the component, and conveys its inactive state to assistive technologies. | boolean | false |
name | name | The name of the form component. | string | undefined | — |
value | value | The value of the form component. | string | '' |
form | form | Gets the form, if any, associated with the form element. The setter accepts a string, which is the id of the form. | HTMLFormElement | null | — |
Field properties
| Property | Attribute | Description | Type | Default |
|---|---|---|---|---|
label | label | Label for the control. Ignored when the control is wrapped in a
<nord-field>, which provides the label via <nord-field-label>. | string | '' |
hint | hint | Optional hint text shown with the control. Ignored inside a <nord-field>,
which provides it via <nord-field-description>. | string | undefined | — |
hintBelow | hint-below | Renders the hint below the control and any error instead of below the label. | boolean | false |
hideLabel | hide-label | Visually hide the label, but still expose it to assistive technologies. | boolean | false |
error | error | Optional error shown with the control. Ignored inside a <nord-field>,
which provides it via <nord-field-error>. | string | undefined | — |
hideRequired | hide-required | Visually hide the required indicator, but still expose the required state to assistive technologies. | boolean | false |
Slots
| Slot name | Description |
|---|---|
start | Leading icon/content; defaults to a search icon. |
end | Trailing icon/content before the clear button. |
Methods
| Method name | Parameters | Description |
|---|---|---|
show() => void | N/A | Open the chip popout. |
hide() => void | N/A | Close the chip popout. |
focus(options?: FocusOptions) => void | options: An object which controls aspects of the focusing process. | Programmatically move focus to the component. |
blur() => void | N/A | Programmatically remove focus from the component. |
click() => void | N/A | Programmatically simulates a click on the component. |
| Event | Detail Type | Description |
|---|---|---|
input | NordEvent | Dispatched as the user types into the input. |
change | NordEvent | Dispatched when the value is committed. |
open | NordEvent | Dispatched when the chip-mode popout is opened. |
close | NordEvent | Dispatched when the chip-mode popout is closed. |
CSS Properties
CSS Custom Properties provide more fine grain control over component presentation. We advise utilizing existing properties on the component before using these.
| Property | Description | Default |
|---|---|---|
--n-filter-input-inline-size | Controls the inline size, or width, of the inline input. | — |