Volt UI
Components

Date Range Picker

A date range picker component with two side-by-side calendars for selecting a start and end date.

Basic Usage

The DateRangePicker component displays two side-by-side calendars for selecting a date range. Click a start date, then click an end date to complete the range. The selected range is highlighted between the two dates.

import { useState } from "react"
import { DateRangePicker } from "@epilot/volt-ui"
import type { DateRange } from "@epilot/volt-ui"

const MyComponent = () => {
  const [value, setValue] = useState<DateRange>({
    start: new Date(),
    end: null,
  })

  return (
    <DateRangePicker
      label="Date Range"
      value={value}
      onChange={setValue}
      locale="en"
    />
  )
}

Disable Past Dates

Use the disablePast prop to prevent selection of dates in the past.

<DateRangePicker
  label="Future Dates Only"
  value={value}
  onChange={setValue}
  disablePast
/>

With Error State

Pass an error prop to display validation errors.

<DateRangePicker
  label="Date Range"
  value={value}
  onChange={setValue}
  error="Please select a valid date range"
/>

API Reference

DateRangePicker

The main component that combines dual date inputs with a popover containing two side-by-side calendars.

PropTypeDefaultDescription
valueDateRange-The selected date range ({ start: Date | null, end: Date | null }).
onChange(range: DateRange) => void-Callback fired when the date range changes.
onBlur() => void-Callback fired when an input loses focus.
disabledbooleanfalseWhen true, the picker is disabled.
disablePastbooleanfalseWhen true, past dates cannot be selected.
labelstring-Label text displayed above the input.
errorstring-Error message to display below the input.
startPlaceholderstring"dd/mm/yyyy"Placeholder for the start date input.
endPlaceholderstring"dd/mm/yyyy"Placeholder for the end date input.
formatstring"dd/MM/yyyy"Date format string (uses date-fns format tokens).
locale"en" | "de" | "fr""de"Locale for month/day names and formatting.
classNamestring-Additional CSS classes for the container.
keyboardIconReactNode<CalendarIcon />Custom icon for the calendar button.
inputAriaLabelstring-Aria-label for the start date input.
openPickerAriaLabelstring"Open date picker"Aria-label for the calendar button.
previousMonthLabelstring"Previous month"Aria-label for the previous month button.
nextMonthLabelstring"Next month"Aria-label for the next month button.
testIdstring-Test ID prefix (creates {testId}-start and {testId}-end).
currentTimeInTimezoneDate-Override "now" for timezone-aware past checks.

RangeCalendar

Standalone two-panel range calendar for date range selection.

PropTypeDefaultDescription
valueDateRange-The selected date range.
onChange(range: DateRange) => void-Callback fired when the range changes.
onRangeComplete() => void-Callback fired when both start and end are selected.
disablePastbooleanfalseWhen true, past dates are disabled.
locale"en" | "de" | "fr""de"Locale for month/day names.
previousMonthLabelstring"Previous month"Aria-label for the previous month button.
nextMonthLabelstring"Next month"Aria-label for the next month button.
currentTimeInTimezoneDate-Override "now" for timezone-aware past checks.

Dependencies

This component reuses the same Calendar component and date-fns utilities as the DateTimePicker.