<kern-date-range-picker>
Date range field: two dates („Von“ – „Bis“) with a calendar popover (two months, one on narrow screens), form-associated. start and end are ISO dates; value and the form value are the ISO 8601 interval start/end (empty until both are set). Typed dates are applied on Enter or when leaving a field; an end before the start is swapped.
Presets: elements in the presets slot with data-range (ISO 8601 duration ending today, e.g. P7D = the last 7 days incl. today) or data-start/data-end set the range on click.
Examples
Date range
Two dates with a calendar popover. start and end are ISO dates; value and the form value are the interval start/end. An end before the start is swapped.
Presets and limits
Elements in the presets slot set the range on click: data-range is an ISO 8601 duration ending today (P7D = the last 7 days incl. today), or use data-start/data-end. max-days limits the length; max is set to today here so no future days can be picked.
Properties
ariaLabelTextstring | undefined
Accessible name when there is no visible label.
clearableboolean
Show a button that empties both dates.
disabledboolean
endstring
Last day (inclusive), ISO YYYY-MM-DD.
errorstring | undefined
firstDayOfWeeknumber | undefined
0 = Sunday … 6 = Saturday; defaults to the locale.
hintstring | undefined
isDateDisabled((iso: string) => boolean) | undefined
Additional rule for unselectable days.
labelstring | undefined
labelClearstring | undefined
labelEndstring | undefined
labelIncompletestring | undefined
Shown when only one date is set.
labelInvalidstring | undefined
labelOpenstring | undefined
labelOutOfRangestring | undefined
labelStartstring | undefined
labelTooLongstring | undefined
Shown when the range is longer than maxDays; {n} is replaced by it.
localestring | undefined
BCP 47 locale; defaults to <html lang>, then the browser language.
maxstring | undefined
Latest allowed date.
maxDaysnumber | undefined
Longest allowed range in days (inclusive).
minstring | undefined
Earliest allowed date.
namestring | undefined
noImplicitSubmitboolean
Enter does not submit the surrounding form.
readonlyboolean
requiredboolean
showWeekNumbersboolean
ISO week numbers in the calendar.
size"md" | "sm"
startstring
First day, ISO YYYY-MM-DD.
valuestring
ISO 8601 interval start/end, empty until both are set; kept in sync with start/end.
Events
kernChangeCustomEvent<{ start: string; end: string; value: string; }>
When the range is complete or cleared.
Methods
hide()hide() => Promise<void>
Closes the calendar.
setFocus()setFocus() => Promise<void>
show()show() => Promise<void>
Opens the calendar.
Slots
footerActions below the calendar
presetsQuick choices beside the calendar, e.g. <kern-button variant="ghost" size="sm" data-range="P7D">
CSS parts
calendarThe popover panel
controlThe field box