FilterBar New Alpha Light DOM & Tailwind

Open in Storybook

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.

OverviewUsageExamplesAccessibilityAPI referenceParts
This component is considered alpha. We're still finalising the API, so it may include a breaking change at any time — use it at your own risk.
Loading...

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.

Copy code
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 input and change.
  • 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. Emits clear, 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 “ +N”. Pair it with 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 label for 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-expanded to 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-expanded relationship.
  • 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 value summary) 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

PropertyAttribute Description TypeDefault
alignalignThe cross-axis alignment of the controls within the bar.'start' | 'center' | 'end''center'

Slots

Slot name Description
Default slotDefault 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.

PropertyDescriptionDefault
--n-filter-bar-gapControls the spacing between the filter controls.var(--n-space-s)
--n-filter-bar-align-itemsControls the cross-axis alignment of the controls.center
Light DOM & Tailwind. This component renders in the light DOM, so you can style it directly with your own CSS or Tailwind utility classes — there is no shadow boundary, and its default styles are low specificity, so your utilities win.

Parts

This component is made up of the following parts.

Filter Add Button

Filter Add Button opens a popout of available filters and emits the chosen one so your app can add it to the bar. Pass a flat list of options, or group them under headings; selecting one fires a select event with the option's id and closes the popout. Like the other filter primitives it is intent-only: it does not track which filters are active. Your app owns the active filters and decides what to do on select (typically render a new Filter Field). Mirrors the Provet Cloud filter add button.

<nord-filter-add-button></nord-filter-add-button>

Props

PropertyAttribute Description TypeDefault
disableddisabledMakes the component disabled. This prevents users from being able to interact with it and conveys its inactive state to assistive technologies.booleanfalse
openopenWhether the popout is open. Set it to open or close the popout programmatically.booleanfalse
sizesizeThe size of the button.'s' | 'm' | 'l''s'

Methods

Method nameParameters Description
show() => voidN/AOpen the popout.
hide() => voidN/AClose the popout.
EventDetail TypeDescription
selectFilterAddButtonSelectEventDispatched with the chosen option's id when an option is selected.
openNordEventDispatched when the popout is opened.
closeNordEventDispatched 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.

PropertyDescriptionDefault
--n-filter-add-button-list-inline-sizeControls the inline size, or width, of the popout list.250px

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

PropertyAttribute Description TypeDefault
labellabelThe label naming what this filter targets, shown on the chip.string''
valuevalueThe committed range as an ISO-8601 interval string YYYY-MM-DD/YYYY-MM-DD, or "" for no selection.string''
minminEarliest selectable date (ISO-8601).string | undefined
maxmaxLatest selectable date (ISO-8601).string | undefined
hidePresetshide-presetsHides the built-in preset list, leaving only the calendar.booleanfalse
firstDayOfWeekfirst-day-of-weekFirst day of the week (0 = Sunday … 6 = Saturday).number | undefined
todaytodayOverrides "today" (ISO-8601), mainly for deterministic tests/demos.string | undefined
removableremovableWhether the whole filter can be removed. When true the trailing affordance is a remove button that fires remove; otherwise it is a clear button.booleanfalse
clearableclearableShows a clear (✕) button while there is a selection. Defaults to true.booleantrue
disableddisabledMakes the component disabled.booleanfalse
sizesizeThe size of the chip controls.'s' | 'm' | 'l''s'
namenameIdentifies the filter (e.g. for your app's active-filter state).string''
openopenWhether the popout is open.booleanfalse

Methods

Method nameParameters Description
show() => voidN/AOpen the popout.
hide() => voidN/AClose the popout.
EventDetail TypeDescription
changeFilterDateRangeChangeEventDispatched when the committed range changes (Apply or clear).
clearFilterDateRangeClearEventDispatched when the chip's clear affordance is pressed.
removeFilterDateRangeRemoveEventDispatched when the chip's remove affordance is pressed.
openNordEventDispatched when the popout is opened.
closeNordEventDispatched 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.

PropertyDescriptionDefault
--n-filter-date-range-popout-inline-sizeControls 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

PropertyAttribute Description TypeDefault
labellabelThe label naming what this filter targets, shown on the chip.string''
namenameA name identifying what this dropdown filters, for form/identification.string''
iconiconThe icon shown on the trigger.string'interface-filter'
sizesizeThe size of the trigger and popout. Defaults to s to match the other filter controls.FilterDropdownSize's'
optionsValueKeyoptions-value-keyThe key on each option object to read the value from. Defaults to value.string'value'
optionsLabelKeyoptions-label-keyThe key on each option object to read the label from. Defaults to label.string'label'
multiplemultipleAllows selecting more than one option. Selected options show a checkbox indicator and the popout stays open after each selection.booleanfalse
searchablesearchableShows a search input at the top of the popout to filter the options.booleanfalse
internalSearchinternal-searchWhether 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).booleantrue
selectAllselect-allShows a "Select all" control at the top of the popout. Only applies with multiple.booleanfalse
clearableclearableShows a clear (✕) button while there is a selection. Pressing it clears the value (firing clear then change) without removing the dropdown.booleantrue
removableremovableWhether 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.booleanfalse
disableddisabledMakes the component disabled. This prevents users from being able to interact with it and conveys its inactive state to assistive technologies.booleanfalse
loadingloadingShows a spinner in the popout while asynchronous results are loading. Pair with internal-search="false" for async search.booleanfalse
openopenWhether the popout is open. Set it to open or close the popout programmatically.booleanfalse
noResultsMessageno-results-messageMessage shown when no options match the search. Defaults to "No results.".string''
labelForUnknownlabel-for-unknownFallback label shown for a selected value that has no matching option.string''

Methods

Method nameParameters Description
show() => voidN/AOpen the popout.
hide() => voidN/AClose the popout.
focus(options?: FocusOptions) => voidoptions: FocusOptionsFocus the trigger button.
EventDetail TypeDescription
changeFilterDropdownChangeEventDispatched when the committed selection changes via user interaction.
search-changeFilterDropdownSearchChangeEventDispatched as the user types when searchable (use with internal-search="false" for async search).
clearFilterDropdownClearEventDispatched when the selection is cleared, before change.
removeFilterDropdownRemoveEventDispatched when the filter is removed (only when removable).
load-moreFilterDropdownLoadMoreEventDispatched when the list is scrolled near its end (infinite scroll).
openNordEventDispatched when the popout is opened.
closeNordEventDispatched 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.

PropertyDescriptionDefault
--n-filter-dropdown-list-inline-sizeControls 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

PropertyAttribute Description TypeDefault
labellabelThe label naming what this filter targets, shown on the chip.string''
valuevalueA 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''
activeactiveForces the active (solid) treatment without a value summary, for filters that are on but have nothing short to show.booleanfalse
clearableclearableShows a clear (✕) button while the chip is active. Defaults to true. Has no effect when removable is set.booleantrue
iconiconThe leading icon shown on the chip.string'interface-filter'
namenameIdentifies the filter (e.g. for your app's active-filter state).string''
removableremovableWhether 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.booleanfalse
disableddisabledMakes the component disabled. This prevents users from being able to interact with it and conveys its inactive state to assistive technologies.booleanfalse
sizesizeThe size of the chip controls.'s' | 'm' | 'l''s'
EventDetail TypeDescription
clearFilterFieldClearEventDispatched when the clear affordance is pressed.
removeFilterFieldRemoveEventDispatched 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

PropertyAttribute Description TypeDefault
modemodeHow 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'
openopenWhether the chip-mode popout is open. Only meaningful with mode="chip".booleanfalse
sizesizeThe 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'
clearableclearableWhether to show a clear (✕) button while there is a value. Clearing resets the value to '', then fires input and change.booleanfalse
placeholderplaceholderPlaceholder text to display within the control.string | undefined
requiredrequiredDetermines 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.booleanfalse
readonlyreadonlyMakes 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.booleanfalse
disableddisabledMakes the component disabled. This prevents users from being able to interact with the component, and conveys its inactive state to assistive technologies.booleanfalse
namenameThe name of the form component.string | undefined
valuevalueThe value of the form component.string''
formformGets 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

PropertyAttribute Description TypeDefault
labellabelLabel for the control. Ignored when the control is wrapped in a <nord-field>, which provides the label via <nord-field-label>.string''
hinthintOptional hint text shown with the control. Ignored inside a <nord-field>, which provides it via <nord-field-description>.string | undefined
hintBelowhint-belowRenders the hint below the control and any error instead of below the label.booleanfalse
hideLabelhide-labelVisually hide the label, but still expose it to assistive technologies.booleanfalse
errorerrorOptional error shown with the control. Ignored inside a <nord-field>, which provides it via <nord-field-error>.string | undefined
hideRequiredhide-requiredVisually hide the required indicator, but still expose the required state to assistive technologies.booleanfalse

Slots

Slot name Description
startLeading icon/content; defaults to a search icon.
endTrailing icon/content before the clear button.

Methods

Method nameParameters Description
show() => voidN/AOpen the chip popout.
hide() => voidN/AClose the chip popout.
focus(options?: FocusOptions) => voidoptions: An object which controls aspects of the focusing process.Programmatically move focus to the component.
blur() => voidN/AProgrammatically remove focus from the component.
click() => voidN/AProgrammatically simulates a click on the component.
EventDetail TypeDescription
inputNordEventDispatched as the user types into the input.
changeNordEventDispatched when the value is committed.
openNordEventDispatched when the chip-mode popout is opened.
closeNordEventDispatched 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.

PropertyDescriptionDefault
--n-filter-input-inline-sizeControls the inline size, or width, of the inline input.

Filter Reset Button

Filter Reset Button clears every active filter at once. It is a thin, intent-only control: it renders a plain button and dispatches a reset event when pressed. Your app owns the active filters and is responsible for clearing them (and any URL/query state) in the handler — the button holds no state of its own. Disable it while there is nothing to reset by binding disabled to whether any filter is active (e.g. ?disabled=${!hasFilters}). Mirrors the Provet Cloud filter reset button.

<nord-filter-reset-button></nord-filter-reset-button>

Props

PropertyAttribute Description TypeDefault
disableddisabledMakes the component disabled. This prevents users from being able to interact with it and conveys its inactive state to assistive technologies. Bind it to whether any filter is active so the control is only enabled when there is something to reset.booleanfalse
sizesizeThe size of the button.'s' | 'm' | 'l''s'
EventDetail TypeDescription
resetNordEventDispatched when the button is pressed to clear all active filters.

CSS Properties

CSS Custom Properties provide more fine grain control over component presentation. We advise utilizing existing properties on the component before using these.

PropertyDescriptionDefault
--n-filter-reset-button-colorControls the text and icon color while the button is enabled.var(--n-color-text-highlight)

Was this page helpful?

Yes No

We use this feedback to improve our documentation.