Skip to content
Focsd homeFocsd homeFocsd
Forms

Date range picker

Start and end dates, typed or picked as one range.

  • Tag: focsd-date-range-picker
  • Pattern: Dialog + grid
  • Category: Forms

Example

HTML
<div class="stack">
<focsd-date-range-picker
label="Trip dates"
value-start="2026-05-04"
value-end="2026-05-08"
locale="en-GB"></focsd-date-range-picker>
</div>

Usage

Import the module once, then use the tag like any HTML element. Every framework below renders the same element; see Frameworks for setup.

<script type="module">
import '@focsd-dev/components/focsd-date-range-picker.js';
</script>
<focsd-date-range-picker label="Trip dates" value-start="2026-05-04" value-end="2026-05-08" locale="en-GB"></focsd-date-range-picker>

API

Attributes

AttributePropertyTypeDefault
value-startvalueStartstring—
value-endvalueEndstring—
namenamestring—
disableddisabledbooleanfalse
requiredrequiredbooleanfalse
readonlyreadOnlybooleanfalse
aria-labelhostAriaLabelstring | nullnull
aria-descriptionhostAriaDescriptionstring | nullnull
aria-labelledbyhostAriaLabelledBystring | nullnull
aria-describedbyhostAriaDescribedBystring | nullnull
label-positionlabelPosition'top' | 'start' | 'end' | undefined—
hinthintstring—
errorerror——
warningwarningstring | undefined—
successsuccessstring | undefined—
error-messageerrorMessagestring | undefined—
warning-messagewarningMessagestring | undefined—
warning-patternwarningPatternstring | undefined—
labellabelstring—
valuevaluestring—
minminstring—
maxmaxstring—
localelocalestring—
stepstepnumber1
autocompleteautocompleteAutoFilloff

Methods

MethodDescription
describedByIds()IDs to add to the inner control's aria-describedby: the hint, then the shown message.
checkValidity()True when the value is valid; otherwise fires invalid and returns false, like native.
reportValidity()Like checkValidity(), and also shows the browser's validation message when invalid.
setCustomValidity(message)Set (non-empty) or clear (empty string) a custom validation error, like native controls.
setValidityState(flags, message, anchor)For subclasses: set the validity flags and message. anchor is the element the browser points its message at.
validate()Show (or clear) the error from the control's own checks: required, type, pattern, min, max and the like. Uses error-message, else the browser's localized message. An error the author set (a server error, say) is left as it is.
clearValidation()Clear the error and warning that validate() and warning-pattern showed (a form reset does).
emitValue(commit)For subclasses: fire the value events, as a native control does on a user edit: input (bubbles, composed), then with commit also change (bubbles, stays in its tree).
idrefText(ids)For subclasses: the text of the elements an ID reference list names, resolved in the host's tree (ID references cannot cross a shadow root), joined by spaces.
showPicker()Open the calendar from code, like native showPicker().
openDialog()Open the calendar dialog and focus its active day. Does nothing while disabled or read-only.

Events

EventDescription
inputFired on every user edit of the value.
changeFired when the user commits a change to the value or state.

CSS parts

Style the inside of the component with ::part(), for example focsd-date-range-picker::part(field).

PartDescription
fieldThe field element.
groupThe group element.
labelThe label element.
rangeAdded to the field of a date range picker.
sublabelThe "Start date" and "End date" labels.
calendarThe calendar inside the dialog.
calendar-dayCalendar parts, re-exported with a `calendar-` prefix (calendar-day, calendar-nav, calendar-heading, calendar-grid, calendar-weekday, calendar-today, calendar-selected, …).
panelThe dialog's content: the calendar, any extra fields and the actions.
actionsThe row of dialog buttons at the bottom.
cancelThe dialog's Cancel button (also exposed as `close`).
closeThe dialog's Cancel button (kept for existing stylesheets).
controlThe control element.
dialogThe dialog element.
layoutThe wrapper that places the label beside or above the body.
bodyThe control, hint and message.
hintThe author hint followed by the date format.
messageThe shown error, warning or success message (also `error`, `warning` or `success`).
message-iconThe message's icon.
announcerThe visually hidden status region.
triggerThe trigger element.

Accessibility

  • autocomplete is forwarded to both inputs.
  • A role="group" named by the label, with two labeled inputs ("Start date", "End date") and one "Choose dates" button.
  • In the dialog the first pick sets the start and the second the end; every day in the range is aria-selected.
  • The form receives <name>-start and <name>-end.
  • Form-associated: participates in FormData, validation, reset, fieldset disabled and back/forward restore.