Usage
Calendar shows a month grid that people can navigate and pick a date from. It has built-in support for setting a minimum and maximum allowed date. Like Date Picker, dates are handled in ISO-8601 format (YYYY-MM-DD).
import "@nordhealth/components/lib/Calendar"
Render a standalone calendar, optionally with an initial value:
Examples
Basic
With no attributes the calendar opens on the current month.
Minimum and maximum
Constrain the selectable range with min and max. Both take ISO-8601 dates and can be used together or on their own.
Range selection
Set range to select a start and end date instead of a single day. The first click sets the start, the second sets the end (the two are swapped if the second is earlier), and the days in between are highlighted with a live preview as you hover. Control or read the selection with range-start and range-end (both ISO-8601), and listen for the range-change event, which fires once a complete range is picked.
Multiple months New since Jul 6, 2026
Set months to show that many consecutive months side by side, starting from the focused month. Combined with range, a selection (and its hover preview) spans every visible month, and the navigation arrows slide the whole window — handy for picking a span that crosses months without paging. Rendered this way, Calendar is itself an inline range picker.
For a complete range-picking control — with presets, the two-month calendar in a popout and Apply/Cancel — use Date Range Picker, which composes Calendar in this mode.
Expanded
Set expand to make the calendar fill the inline size of its container.
Small
The size attribute accepts s and m (default).
Inline
Remove the calendar's drop shadow to embed it flush in the page rather than as a floating surface.
Change today
Override which date is treated as "today" with the today attribute, useful for testing or when the client clock can't be trusted.
Disabling days
Set the isDateDisabled property to a function that returns true for dates that can't be selected — here weekends are disallowed.
Highlighting days
Set the isDateHighlighted property to mark notable dates; return a string to give the highlight an accessible label.
Focus date event
Calendar fires a nord-focus-date event as the focused day changes during keyboard navigation, letting you react to the day a user is hovering before they commit to it.
RTL
Calendar follows the document or container direction. Toggle the direction to see the layout mirror.
Accessibility
- Calendar manages keyboard navigation between days, so users can move through the grid and select a date with the keyboard alone.
- Supply
value,min,maxandtodayin ISO-8601 format (YYYY-MM-DD) so the selected, bounded and current dates stay consistent for assistive technology. - Calendar is a date-selection control without its own label; when embedding it in a form, pair it with a Field and Field Label to give it an accessible name.
- Listen for the
changeevent to react to a date selection rather than polling the value.
API reference
Calendar
Calendar allows user to pick a date. It comes with built-in functionality that allows you to set a minimum and a maximum allowed date. Please note that the date must be passed in ISO-8601 format.
<nord-calendar></nord-calendar>Props
| Property | Attribute | Description | Type | Default |
|---|---|---|---|---|
value | value | The selected date on the calendar. Must be in IS0-8601 format: YYYY-MM-DD. | string | '' |
firstDayOfWeek | first-day-of-week | Which day is considered first day of the week? 0 for Sunday, 1 for Monday, etc.
Default is Monday. | DaysOfWeek | — |
min | min | Minimum date allowed to be picked. Must be in IS0-8601 format: YYYY-MM-DD. This setting can be used alone or together with the max property. | string | undefined | — |
max | max | Maximum date allowed to be picked. Must be in IS0-8601 format: YYYY-MM-DD. This setting can be used alone or together with the min property. | string | undefined | — |
today | today | The date that is considered today. Must be in IS0-8601 format: YYYY-MM-DD. If not set, the current local date of the user is used. | string | undefined | — |
expand | expand | Controls whether the calendar expands to fill the width of its container. | boolean | false |
size | size | Controls the size of the calendar. | 's' | 'm' | 'm' |
range | range | Opt into range selection. When true, clicking selects a range start, and
the next click selects the end (the two clicks are swapped if the second is
earlier than the first). The in-range days are styled, and a hover preview
shows the range that would result. A completed range fires range-change.
This is off by default, so the calendar keeps its single-date behaviour
(the value/change API) unless range is set. | boolean | false |
rangeStart | range-start | The start of the selected range, in ISO-8601 format: YYYY-MM-DD. Only used
when range is set. Pair with rangeEnd to control the selection. | string | undefined | — |
rangeEnd | range-end | The end of the selected range, in ISO-8601 format: YYYY-MM-DD. Only used
when range is set. Pair with rangeStart to control the selection. | string | undefined | — |
months | months | The number of consecutive months to display side by side, starting from the
focused month. Defaults to 1. Useful with range for picking a span that
crosses months without paging — the range and its hover preview span every
visible month, and the navigation arrows slide the whole window. With more
than one month the month/year dropdowns are replaced by static titles. | number | 1 |
Methods
| Method name | Parameters | Description |
|---|---|---|
focus(options?: FocusOptions & { target: 'day' | 'month' }) => void | options: An object which controls aspects of the focusing process. | Programmatically move focus to the calendar. |
| Event | Detail Type | Description |
|---|---|---|
range-change | DateRangeSelectEvent | Dispatched in range mode when a complete range (start and end) has been selected. |
nord-focus-date | DateSelectEvent | Dispatched when the calendar's focused date changes. |
change | DateSelectEvent | Dispatched when a date is selected and the value changes. |
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-calendar-border-radius | Controls how rounded the corners are, using border radius tokens. | var(--n-border-radius) |
--n-calendar-box-shadow | Controls the surrounding shadow, using box shadow tokens. | var(--n-box-shadow-popout) |
--n-calendar-padding-block | Controls the block padding of the calendar, using space tokens. | var(--n-space-m) |
--n-calendar-padding-inline | Controls the inline padding of the calendar, using space tokens. | var(--n-space-m) |
--n-calendar-day-size | Controls the block and inline size of each day cell, using space tokens. | var(--n-space-xl) |
--n-calendar-day-font-size | Controls the font size of each day cell, using font size tokens. | var(--n-font-size-m) |
--n-calendar-select-label-font-size | Controls the font size of the month and year select labels, using font size tokens. | var(--n-font-size-xl) |
--n-calendar-nav-padding-inline | Controls the inline padding of the previous and next month buttons. | 11px |
--n-calendar-nav-gap | Controls the gap between the previous and next month buttons, using space tokens. | var(--n-space-xs) |
--n-calendar-header-margin-block-end | Controls the block-end margin of the calendar header, using space tokens. | var(--n-space-m) |
--n-calendar-header-padding-block-end | Controls the block-end padding of the calendar header, using space tokens. | 0 |
--n-calendar-header-gap | Controls the gap between the month/year selects and the navigation buttons, using space tokens. | var(--n-space-s) |
--n-calendar-inline-size | Controls the inline size of the calendar. Defaults to 100% when the expand attribute is set. | max-content |
Dependencies
This component is internally dependent on the following components:
- <nord-button>
Button
Buttons are used for interface actions. Primary style should be used only once per section for main call-to-action, while other styles can appear more frequently.
- <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-visually-hidden>
VisuallyHidden
Visually hidden is used when an element needs to be available to assistive technologies like screen readers, but be otherwise hidden.
Design guidelinesFor designers
Usage
This section includes guidelines for designers and developers about the usage of this component in different contexts.
Do
- Use when the user needs to choose a single date or a date range.
- Close calendar after a single date is selected, unless a range with a start and end date is required.
Don’t
- Don’t use for entering date of birth. Use input component instead.
- Don’t use for choosing a date that is over 10 years in the future or the past.
Keyboard accessibility
Calendar component is built to closely follow W3C Date Picker Dialog example with some small exceptions to e.g. better support iOS VoiceOver and Android TalkBack.
Month/year buttons
Space, Enter: Changes the month and/or year displayed.
Calendar grid
Space, Enter: Selects a date.Arrow up: Moves focus to the same day of the previous week.Arrow down: Moves focus to the same day of the next week.Arrow right: Moves focus to the next day. In right-to-left languages, moves focus to the previous day.Arrow left: Moves focus to the previous day. In right-to-left languages, moves focus to the next day.Home: Moves focus to the first day (e.g Monday) of the current week.End: Moves focus to the last day (e.g. Sunday) of the current week.Page Up: Changes the grid of dates to the previous month and sets focus on the same day of the same week.Shift + Page Up: Changes the grid of dates to the previous year and sets focus on the same day of the same week.Page Down: Changes the grid of dates to the next month and sets focus on the same day of the same week.Shift + Page Down: Changes the grid of dates to the next year and sets focus on the same day of the same week.