Date dropdown - Code
Basic
With presets
Require confirmation
By default, date dropdowns apply the range and close as soon as the range is complete. Set requireConfirmation to only apply the range when users click Confirm. Cancel, Escape or clicking outside discards the pending selection. Date dropdowns emit dateRangeChange for every pick and dateSelect only when they apply the range.
Display format
Set displayFormat to show the selected dates in the dropdown button in a different format than format.
from, to, minDate, maxDate and emitted values keep using format.
API for ix-date-dropdown
Properties
Used to set the initial select date range as well as the button name,
if not set or no according date range label is found, nothing will be selected
date-range-idstring'custom'An array of predefined date range options for the date picker.
Each option is an object with a label describing the range and a function
that returns the start and end dates of the range as a DateRangeOption object.
Example format:
{
id: 'some unique id',
label: 'Name of the range',
from: undefined, to: '2023/03/29'
},
// ... other predefined date range options ...
DateDropdownOption[][]Disable the button that opens the dropdown containing the date picker.
disabledbooleanfalseDate format used to display the selected dates in the dropdown button.
from, to, minDate, maxDate and emitted values keep using format.
Defaults to format.
See https://moment.github.io/luxon/#/formatting?id=table-of-tokens for all available tokens.
display-formatstring | undefinedEnable Popover API rendering for dropdown.
enable-top-layerbooleanfalseDate format string.
See https://moment.github.io/luxon/#/formatting?id=table-of-tokens for all available tokens.
formatstring'yyyy/LL/dd'Picker date. If the picker is in range mode this property is the start date.
If set to null no default start date will be pre-selected.
Format is based on format
fromstring''Text of the cancel button shown when requireConfirmation is enabled.
i18n-cancelstring'Cancel'Text of the confirm button shown when requireConfirmation is enabled.
i18n-confirmstring'Confirm'Text for the done button. Will be used for translation.
i18n-donestring'Done'Text for the done button. Will be used for translation.
i18n-no-rangestring'No range set'Loading button
loadingbooleanfalseLocale identifier (e.g. 'en' or 'de').
localestring | undefinedThe latest date that can be selected by the date picker.
If not set there will be no restriction.
max-datestring''The earliest date that can be selected by the date picker.
If not set there will be no restriction.
min-datestring''If true, a date range picked in the dropdown is only applied after the
user confirms it with the confirm button, which emits dateSelect. The
trigger label keeps the applied range until then, while dateRangeChange
still reports every pick. The cancel button, pressing Escape or clicking
outside the dropdown discards the pending selection.
require-confirmationbooleanfalseShows week numbers displayed on the left side of the date picker
show-week-numbersbooleanfalseIf true disables date range selection (from/to).
single-selectionbooleanfalsePicker date. If the picker is in range mode this property is the end date.
If the picker is not in range mode leave this value null
Format is based on format
tostring''Button variant
variant"danger-primary" | "danger-secondary" | "danger-tertiary" | "primary" | "secondary" | "subtle-primary" | "subtle-secondary" | "subtle-tertiary" | "tertiary"'primary'The index of the day the week starts on, as a 0-based index into Luxon's
Info.weekdays() array. That array is always ordered Monday-first
regardless of locale, so 0 is Monday, 1 is Tuesday and 6 is Sunday.
E.g. weekStartIndex = 6 results in starting the week on Sunday.
week-start-indexnumber0Methods
Events
EventEmitter for date range change events.
This event is emitted when the date range changes within the component.
The event payload contains information about the selected date range.
When a pending selection is discarded, it is emitted with the applied
range again.
Use dateSelect to only receive applied ranges.
dateRangeChangeDateRange<string> & { isoFrom?: string | undefined; isoTo?: string | undefined; } & { id: string; }Emitted when the user applies a changed range: on confirm with
requireConfirmation, otherwise when a complete range or a predefined
range is picked.
It is not emitted for programmatic prop input changes.
dateSelectDateRange<string> & { isoFrom?: string | undefined; isoTo?: string | undefined; } & { id: string; }