Usage
Filter Date Range is a complete date-range filter: a chip trigger that opens a popout containing the inline Date Range Picker — built-in presets, a two-month calendar (one month on narrow screens) and an Apply action. It is the date-range counterpart to Filter Dropdown and renders the shared filter chip via Filter Field.
import "@nordhealth/components/lib/FilterDateRange"
It works inside a Filter Bar alongside the other filters. The committed value is an ISO-8601 interval string YYYY-MM-DD/YYYY-MM-DD; the chip shows the formatted range ("Created is 2 Jun 2024 – 16 Jun 2024") for you. Listen for change and own the active-filter/URL state in your app.
Examples
Basic
Inactive, the chip is dashed and shows just the label. Set value (or apply a range in the popout) and it shows the formatted range, highlighted.
Removable
Add removable so the trailing affordance removes the whole filter (firing remove) instead of clearing it. Remove the filter from the bar in the handler.
Calendar only
Add hide-presets to drop the preset list and show only the calendar.
Min and max
Constrain the selectable dates with min and max (both ISO YYYY-MM-DD). Dates outside the range are disallowed in the calendar.
Sizes
The size attribute accepts s (default), m and l, matching the other filter controls.
Disabled
Set disabled to prevent interaction.
Accessibility
- The chip trigger is a button associated with its popout via
aria-controls,aria-haspopupandaria-expanded. The icon-only clear and remove buttons expose their purpose to assistive technology via visually-hidden labels. - The popout is a date-range picker dialog: the calendar is keyboard navigable and the presets and Apply action are reachable and labelled.
- The control emits intent only (
change,clear,remove) — keep the active-filter state your app maintains reflected on the chip so the current selection is announced.
API reference
FilterDateRange
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. | — |
Dependencies
This component is internally dependent on the following components:
- <nord-date-range-picker>
DateRangePicker
Date Range Picker lets people choose a start and end date as a single range, either from a built-in list of presets (Today, Last 7 days, This month, …) or from a range calendar. It is a control only — compose it inside a Field for a label, hint or error, like a native input. The committed value is an ISO-8601 interval string YYYY-MM-DD/YYYY-MM-DD; the convenience start-date / end-date props and the valueAsDateRange getter/setter stay in sync with it. Selecting in the popout builds a *pending* range; **Apply** commits it (firing change), **Cancel** reverts to the last committed value, and **Clear** empties it.
- <nord-icon>
Icon
Icons are used to provide additional meaning or in places where text label doesn’t fit. Icon component allows you to display an icon from the Nordicons library.
- <nord-popout>
Popout
Popouts are small overlays that open on demand. They let users access additional content and actions without cluttering the page.