Back to Tuist

DatePicker

noora/docs/components/datepicker.md

4.204.03.3 KB
Original Source
<!-- Generated by scripts/generate-web-components.js. Do not edit directly. -->

DatePicker

Selects a date range with a two-month calendar, optional presets, and editable range fields.

html
<noora-date-picker label="Select date range"></noora-date-picker>

Attributes

AttributeType or allowed valuesDefaultDescription
labelstring"Select date range"Sets the trigger label when no range is selected.
namestringNoneSets the submitted field-name prefix for [start] and [end] values.
startstringNoneSets the start date in year-month-day format.
endstringNoneSets the end date in year-month-day format.
minstringNoneSets the earliest selectable date.
maxstringNoneSets the latest selectable date.
selected-presetstringNoneIdentifies the selected preset.
start-of-weeknumber0Sets the first weekday, where zero is Sunday and one is Monday.
disabledbooleanfalseDisables interaction.
openbooleanfalseControls whether the picker is open.

Properties

PropertyType or allowed valuesDefaultDescription
presetsArray<Record<string, unknown>>[]Defines presets programmatically when declarative noora-date-picker-preset children are not used.

Events

EventTypeDescription
noora-open-changeCustomEvent<{ open: boolean }>Emitted when the date picker opens or closes.
noora-period-changeCustomEvent<{ start: string; end: string; preset: string | undefined }>Emitted when a date range is applied.
noora-cancelCustomEvent<Record<string, never>>Emitted when date selection is cancelled.

Slots

SlotDescription
defaultDeclarative noora-date-picker-preset children.
actionsAdditional footer actions.

Styling parts

PartDescription
triggerThe range trigger.
contentThe picker content.
calendarThe calendar and range controls.
monthOne calendar month.

A picker named range submits its dates as range[start] and range[end].

Range changes emit a noora-period-change event after Apply is selected.

Cancel emits a noora-cancel event.

Slotted action buttons can use data-action="cancel" or data-action="apply".

Default date picker

Open the picker with common presets and footer actions.

html
<noora-date-picker selected-preset="7d">
  <noora-date-picker-preset value="1h" start="2026-07-27" end="2026-07-27">Last 1 hour</noora-date-picker-preset>
  <noora-date-picker-preset value="24h" start="2026-07-26" end="2026-07-27">Last 24 hours</noora-date-picker-preset>
  <noora-date-picker-preset value="7d" start="2026-07-21" end="2026-07-27">Last 7 days</noora-date-picker-preset>
  <noora-date-picker-preset value="30d" start="2026-06-28" end="2026-07-27">Last 30 days</noora-date-picker-preset>
  <noora-date-picker-preset value="custom">Custom</noora-date-picker-preset>
  <noora-button slot="actions" type="button" variant="secondary" size="medium" data-action="cancel">Cancel</noora-button>
  <noora-button slot="actions" type="button" variant="primary" size="medium" data-action="apply">Apply</noora-button>
</noora-date-picker>