Date Range Picker
A date input component with an integrated calendar popup for selecting date ranges with separate "from" and "to" date values.
Overview
The date range picker allows users to select a start and end date to define a continuous date range. It combines text input fields with a calendar, giving users the flexibility to either manually type familiar dates or visually select date ranges from a calendar view.
The component automatically handles date formatting and validation for manual entries while ensuring the end date cannot be earlier than the start date.
Usage
forge-date-range-picker wraps a text field with two inputs — “from” and “to” — and adds a calendar popup for picking both ends of a range, through from, to, min, max, disabledDates, disabledDaysOfWeek, masked, showToday, and showClear. Use it whenever a user is entering a span of dates, like time off or a project’s start and end; for a single date, use a date picker instead.
Rules
Basic usage
Type into either input or use the trailing calendar button to open the popup and pick both ends of the range.
A date range picker with typed inputs and a calendar popup.
<forge-date-range-picker style="width: 263px">
<forge-text-field>
<label for="input-date-range-picker-01" slot="label">
Date
</label>
<input type="text" id="input-date-range-picker-01" autocomplete="off" placeholder="mm/dd/yyyy" autocorrect="off" autocapitalize="off" role="combobox" aria-live="assertive" aria-atomic aria-haspopup aria-owns="forge-date-range-picker-v7zqn" aria-controls="forge-aria-controls-placeholder">
<span data-forge-multi-input-separator aria-hidden>
-
</span>
<input type="text" id="input-date-range-picker-02" autocomplete="off" placeholder="mm/dd/yyyy" autocorrect="off" autocapitalize="off" role="combobox" aria-live="assertive" aria-atomic aria-haspopup aria-owns="forge-date-range-picker-v7zqn" aria-label="To date" aria-controls="forge-aria-controls-placeholder">
<forge-icon-button aria-label="Toggle calendar" slot="end" density="medium">
<forge-icon name="date_range">
</forge-icon>
</forge-icon-button>
</forge-text-field>
</forge-date-range-picker>
<script type="module">
import { IconRegistry } from "@tylertech/forge/icon";
import { tylIconDateRange } from "@tylertech/tyler-icons";
IconRegistry.define([tylIconDateRange]);
</script>Constraints
Set min and max to bound both ends of the range to a valid window.
A date range picker bounded to a min/max range.
<forge-date-range-picker min="01/01/2026" max="12/31/2026">
<forge-text-field>
<label for="date-range-min-01">
Project span
</label>
<input type="text" id="date-range-min-01" autocomplete="off" placeholder="mm/dd/yyyy" />
<input type="text" id="date-range-min-02" autocomplete="off" placeholder="mm/dd/yyyy" />
</forge-text-field>
</forge-date-range-picker>Masking
Set masked to apply an input mask, shown as a placeholder in each field, so typed dates are corrected to a consistent format as the user types.
A masked date range picker showing its format as a placeholder.
<forge-date-range-picker masked show-mask-format>
<forge-text-field>
<label for="date-range-masked-01">
Date range
</label>
<input type="text" id="date-range-masked-01" autocomplete="off" />
<input type="text" id="date-range-masked-02" autocomplete="off" />
</forge-text-field>
</forge-date-range-picker>Today and clear shortcuts
Set showToday and showClear to add shortcuts to the calendar popup — disable the Today shortcut for a range that only accepts future dates.
Disabling the Today shortcut for a future-only range.
<forge-date-range-picker>
<forge-text-field>
<label for="date-range-shortcuts-01">
Future range
</label>
<input type="text" id="date-range-shortcuts-01" autocomplete="off" placeholder="mm/dd/yyyy" />
<input type="text" id="date-range-shortcuts-02" autocomplete="off" placeholder="mm/dd/yyyy" />
</forge-text-field>
</forge-date-range-picker>Disabled
Set disabled to prevent typing or opening the calendar popup.
A disabled date range picker.
<forge-date-range-picker disabled>
<forge-text-field disabled>
<label for="date-range-disabled-01">
Date range
</label>
<input type="text" id="date-range-disabled-01" autocomplete="off" placeholder="mm/dd/yyyy" />
<input type="text" id="date-range-disabled-02" autocomplete="off" placeholder="mm/dd/yyyy" />
</forge-text-field>
</forge-date-range-picker>A date input component with integrated calendar popup for selecting date ranges with separate "from" and "to" date values.
import "@tylertech/forge/date-range-picker";| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
from | — | Date | string | null | undefined | null | Gets/sets the "from" date range value. |
to | — | Date | string | null | undefined | null | Gets/sets the "to" date range value. |
value | — | TValue | null | Gets/sets the date range value. |
min | min | string | null | The minimum date the calendar will allow. |
max | max | string | null | The maximum date the calendar will allow. |
disabledDates | — | Date | Date[] | null | undefined | null | Gets/sets the disabled date range values. |
open | open | boolean | false | Whether the calendar dropdown is open. |
parseCallback | — | DatePickerParseCallback | parseDate | Gets/sets the callback used to parse date strings. |
formatCallback | — | DatePickerFormatCallback | formatDate | Gets/sets the callback used to format date strings. |
prepareMaskCallback | — | DatePickerPrepareMaskCallback | prepareDateMask | Gets/sets the callback used to prepare the mask for the date input. |
disableDayCallback | — | (date: Date) => boolean | undefined | Gets/sets the callback used to disable days in the calendar. |
popupClasses | popup-classes | string | '' | The CSS classes that are applied to the popup element. |
disabled | disabled | boolean | false | Whether the date picker is disabled or not. |
masked | masked | boolean | false | Whether the input mask is applied or not. |
maskFormat | mask-format | string | MM/DD/YYYY | The mask format that displayed in the input. |
showMaskFormat | show-mask-format | boolean | false | Whether the mask format is displayed in the input or not. Only applies if `masked` is `true`. |
valueMode | value-mode | DatePickerValueMode | string | The type for the `value` property and `forge-date-picker-change` event. |
notifyInputValueChanges | — | boolean | false | Gets/sets the state of whether to notify input value changes. |
allowInvalidDate | allow-invalid-date | boolean | false | Whether to allow an invalid date to be input. When true, the date picker will not clear out the value of the input if the date was invalid (i.e. could not be parsed). |
showToday | show-today | boolean | false | Whether the today button is visible in the popup. |
showClear | show-clear | boolean | false | Whether the clear button is visible in the popup. |
disabledDaysOfWeek | disabled-days-of-week | string | [] | The days of the week to disable from selection. |
yearRange | year-range | string | '' | The year range. |
locale | locale | string | undefined | The locale to use. |
dateFormat | date-format | DatePickerDateFormat | MM/DD/YYYY | The date format to use for the date picker. |
shortcuts | shortcuts | DatePickerShortcuts | — | When specifies as an attribute you can only use the `off` value to disable shortcuts. Otherwise, you can use the `shortcuts` property to set your own shortcuts. |
calendarText | calendar-text | DatePickerCalendarDropdownText | — | Customized strings to display in the calendar dropdown UI. |
| Name | Type | Description |
|---|---|---|
forge-date-range-picker-change | CustomEvent<IDateRangePickerChangeEventData> | Emits when the value of the date range picker changes. |
forge-date-range-picker-open | CustomEvent<void> | Emits when the date range picker calendar opens. |
forge-date-range-picker-close | CustomEvent<void> | Emits when the date range picker calendar closes. |
forge-date-range-picker-input | CustomEvent<string> | Emits when the user inputs a value into the date range picker. |
Screen reader behavior
Verify that keyboard navigation within the calendar popup is announced by a screen reader as the user moves between days.
The date range picker automatically applies aria-live, aria-atomic, aria-haspopup, aria-expanded, aria-owns, and aria-disabled to both the start and end <input> elements for you. You’re still responsible for adding an aria-label to each input if it doesn’t have an associated <label> element.