Date Range Picker
A date field that opens one or more month calendars for picking a start and an end date.
<arc-date-range-picker>Overview
DateRangePicker is DatePicker for a start and end date. The read-only field shows the range as "Jan 5 – Feb 2, 2026", while start and end hold ISO dates (YYYY-MM-DD). value joins them as an ISO 8601 interval ("2026-01-05/2026-02-02"), and that string is what submits with the form under name. form.reset() restores the initial range.
The first click, or Enter on a focused day, sets the start. Until you pick the end, hovering or focusing another day previews the range. The second click sets the end, swapping the two if it's earlier, fires arc-change with the interval as value plus start and end, and closes the popup. A third click starts a new range. months sets how many month panels show (2 by default). They sit side by side and stack when the popup is too narrow, with one pair of previous and next buttons.
presets adds a rail of quick ranges on the left. Each entry is { label, days } and selects the last days days ending today, fires arc-change and closes the popup.
Guidelines
Do
- Add presets for the ranges people pick most, such as 7, 30 and 90 days
- Send `start` and `end`, or the interval `value`, to APIs. Never parse the display text
- Set `min` and `max` when only some dates have data, as in a report
- Set `months="1"` in narrow places, such as a filter popover, where two panels would overflow
Don't
- Don't use it for a single date. Use DatePicker
- Don't treat the first click as a value. `arc-change` only fires once the end date is chosen
- Don't build your own preset buttons when `presets` does the job
- Don't set `min` later than `max`. Every day is disabled
Features
- The day grids are one tab stop. Arrow keys, Home, End, Page Up and Page Down move focus and turn the month at the edges
- The start and end days get ", range start" and ", range end" added to their labels
- A polite live region announces progress, such as "Start date set. Choose end date."
- Escape closes the popup and puts focus back in the field. A click outside also closes it
- `min` and `max` dim and disable days outside the range, and `required` keeps the field invalid until both dates are set
- The popup renders in the top layer, so an `overflow: hidden` ancestor doesn't clip it
Preview
Usage
This component needs JavaScript. Use the Web Component or a framework wrapper.
<arc-date-range-picker
label="Reporting Period"
presets='[{"label":"Last 7 days","days":7},{"label":"Last 30 days","days":30}]'
></arc-date-range-picker>import { DateRangePicker } from '@arclux/arc-ui-react';
export default function Example() {
return (
<DateRangePicker
label="Reporting Period"
presets={[{ label: 'Last 7 days', days: 7 }, { label: 'Last 30 days', days: 30 }]}
onArcChange={(e) => console.log(e.detail.start, e.detail.end)}
></DateRangePicker>
);
}<script setup>
import { DateRangePicker } from '@arclux/arc-ui-vue';
const presets = [{ label: 'Last 7 days', days: 7 }, { label: 'Last 30 days', days: 30 }];
</script>
<template>
<DateRangePicker label="Reporting Period" :presets="presets" />
</template><script>
import { DateRangePicker } from '@arclux/arc-ui-svelte';
const presets = [{ label: 'Last 7 days', days: 7 }, { label: 'Last 30 days', days: 30 }];
</script>
<DateRangePicker label="Reporting Period" presets={presets} />import { Component } from '@angular/core';
import { DateRangePicker } from '@arclux/arc-ui-angular';
@Component({
imports: [DateRangePicker],
template: `
<arc-date-range-picker label="Reporting Period" [presets]="presets"></arc-date-range-picker>
`,
})
export class MyComponent {
presets = [{ label: 'Last 7 days', days: 7 }, { label: 'Last 30 days', days: 30 }];
}import { DateRangePicker } from '@arclux/arc-ui-solid';
export default function Example() {
return (
<DateRangePicker
label="Reporting Period"
presets={[{ label: 'Last 7 days', days: 7 }]} />
);
}import { DateRangePicker } from '@arclux/arc-ui-preact';
export default function Example() {
return (
<DateRangePicker
label="Reporting Period"
presets={[{ label: 'Last 7 days', days: 7 }]} />
);
}API
autoValidatesbooleanfalse- Runs its own constraint logic and owns the whole validity flag set.
valuestring- Read-derived ISO 8601 interval ("start/end") when both dates are set, otherwise an empty string. This is the value submitted with forms. Assigning "start/end" sets both dates.
localestring''- BCP 47 tag used for month and weekday names. Defaults to the document's
lang, then the browser's language. first-day-of-weeknumber0- Which day the week starts on, 1 = Monday … 7 = Sunday. Defaults to the locale's own convention.
startstring''- Range start date as an ISO string (YYYY-MM-DD). Empty when unset. Set both start and end to pre-select a range.
endstring''- Range end date as an ISO string (YYYY-MM-DD). Empty when unset or while an end date is pending.
namestring''- Form field name used when the interval value is submitted with a form.
minstring''- Minimum selectable date as an ISO string. Earlier days are dimmed and non-interactive.
maxstring''- Maximum selectable date as an ISO string. Later days are dimmed and non-interactive.
placeholderstring'Select date range'- Placeholder text shown in the input when no range is selected.
disabledbooleanfalse- Disables the picker, reducing opacity and preventing the popup from opening.
labelstring''- Label text rendered above the input in uppercase accent font styling.
monthsnumber2- Number of month panels shown in the popup. Panels sit side by side and stack vertically when the popup is too narrow.
presetsArray<{label:string,days:number}>[]- Quick ranges rendered as a left rail. Each preset selects the last N days ending today and closes the popup. Hidden when empty.
requiredbooleanfalse- Marks the control invalid (valueMissing) until a complete range is selected.
openbooleanfalse- Whether the calendar dropdown is visible. Reflected so it can be opened programmatically or styled from CSS. Held at
falsewhiledisabled. size'sm' | 'md' | 'lg''md'- Control size.
mdis the default;smandlgscale the field padding. formAssociatedbooleantruepropertiesobject{ // flag(), unlike `disabled`. The exclusion in props.js is specifically // about form-associated *platform* semantics: a `disabled` content // attribute that is merely present makes the element actually disabled // per the HTML spec, and formDisabledCallback assigns the property back, // so no converter can win. Neither of these is platform-mapped: // `required` is enforced by _computeValidity() below and `readonly` by // each component's own interaction handlers, so the stock converter buys // nothing here and costs the usual bug: `required="false"` read as true, // blocking submission of a form the author meant to leave optional. // Finding #48's shape, across all 26 form controls at once. required: flag(false), readonly: flag(false), }- Lit merges static properties up the prototype chain, so every consumer
gets these without declaring them.
requiredparticipates in constraint validation below;readonlyreflects for styling and is enforced by each component's interaction handlers (the mixin can't know which gestures mutate state). formvalidityvalidationMessagereadonlybooleanfalse
Methods
checkValidity()boolean- Whether the control currently satisfies its constraints, per the native
constraint-validation API. Fires
invalidon the element when it does not, and reports nothing to the user. reportValidity()boolean- As checkValidity(), but also shows the browser's validation message against the control when it fails.
Events
arc-changedetail:{ value: string, start: string, end: string }- Fired when a complete range is committed (second day clicked or preset applied).
detail.valueis the ISO 8601 interval string, the same shape as thevalueproperty;startandendcarry the two ends separately.