Volt UI
Components

Date Time Picker

A date and time picker component with calendar and time selection.

Basic Usage

The DateTimePicker component combines a text input with a popover containing a calendar and time picker for selecting date and time values.

import { useState } from "react"
import { DateTimePicker } from "@epilot/volt-ui"

const MyComponent = () => {
  const [value, setValue] = useState<Date>(new Date())

  return (
    <DateTimePicker
      label="Appointment"
      value={value}
      onChange={setValue}
      locale="en"
    />
  )
}

Disable Past Dates

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

<DateTimePicker
  label="Future Date Only"
  value={value}
  onChange={setValue}
  disablePast
/>

With Error State

Pass an error prop to display validation errors.

<DateTimePicker
  label="Date & Time"
  value={value}
  onChange={setValue}
  error="Please select a valid date"
/>

Localization

The component supports multiple locales (en, de, fr) for month names, weekday labels, and date formatting.

<DateTimePicker
  label="Termin"
  value={value}
  onChange={setValue}
  locale="de"
  format="dd.MM.yyyy HH:mm"
  placeholder="tt.mm.jjjj hh:mm"
/>

With Today Button

Enable the "Today" button to allow users to quickly select the current date.

<DateTimePicker
  label="Select Date"
  value={value}
  onChange={setValue}
  showTodayButton
  todayLabel="Today"
/>

Side Layout

Use timePickerPosition="side" to place the time picker next to the calendar instead of below it.

<DateTimePicker
  label="Side Layout"
  value={value}
  onChange={setValue}
  timePickerPosition="side"
/>

Side Layout with Today Button

When using timePickerPosition="side" together with showTodayButton, the time picker automatically adjusts its height to match the calendar including the Today button.

<DateTimePicker
  label="Side Layout + Today"
  value={value}
  onChange={setValue}
  timePickerPosition="side"
  showTodayButton
  todayLabel="Today"
/>

API Reference

DateTimePicker

The main component that combines input, calendar, and time picker.

PropTypeDefaultDescription
valueDate-The selected date and time value.
onChange(date: Date) => void-Callback fired when the date/time changes.
onBlur() => void-Callback fired when the input loses focus.
disabledbooleanfalseWhen true, the picker is disabled.
disablePastbooleanfalseWhen true, past dates and times cannot be selected.
labelstring-Label text displayed above the input.
errorstring-Error message to display below the input.
placeholderstring"dd/mm/yyyy hh:mm"Placeholder text for the input.
formatstring"dd/MM/yyyy HH:mm"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.
okLabelstring"OK"Label for the OK button.
cancelLabelstring"Cancel"Label for the Cancel button.
inputAriaLabelstring"change date and time"Aria-label for the input field.
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.
hoursLabelstring"HH"Label for the hours column.
minutesLabelstring"MM"Label for the minutes column.
showTodayButtonbooleanfalseWhen true, shows a "Today" button below the calendar.
todayLabelstring"Today"Label for the Today button.
testIdstring-Test ID for the input (sets data-testid).
currentTimeInTimezoneDate-Override "now" for timezone-aware past checks.
timePickerPosition"bottom" | "side""bottom"Position the time picker below or beside the calendar.

Calendar

Standalone calendar component for date selection. The calendar supports drill-down navigation: click the month/year header to switch to a month picker, then click the year to switch to a decade/year picker. This allows quick navigation to any date without repeated arrow clicks.

PropTypeDefaultDescription
valueDate-The selected date.
onChange(date: Date) => void-Callback fired when a date is selected.
onDateSelect() => void-Callback fired after date selection (for closing picker).
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.
showTodayButtonbooleanfalseWhen true, shows a "Today" button below the calendar.
todayLabelstring"Today"Label for the Today button.
currentTimeInTimezoneDate-Override "now" for timezone-aware past checks.

TimePicker

Standalone time picker component with scrollable hour and minute columns.

PropTypeDefaultDescription
valueDate-The date object containing the time to display.
onChange(date: Date) => void-Callback fired when time changes.
onTimeSelect() => void-Callback fired after time selection.
disablePastbooleanfalseWhen true, past times are disabled (only on current day).
locale"en" | "de" | "fr""de"Locale (reserved for future use).
hoursLabelstring"HH"Label for the hours column.
minutesLabelstring"MM"Label for the minutes column.
currentTimeInTimezoneDate-Override "now" for timezone-aware past checks.

Dependencies

This component uses date-fns for date manipulation and formatting, which is included as a dependency of @epilot/volt-ui.