GitHub
Core
Glass
Brutal
Humanist

Date Picker
Pro

Date pickers allow users to select dates from a calendar interface. They support date constraints, keyboard navigation, and confirm/cancel actions.

DatePicker Playground

DatePicker Playground
Preview
Code

DateRangePicker Playground

DateRangePicker Playground
Preview
Code
April 2026May 2026
Controls
Presets:

Installation

You can add the date picker component to your project manually:

1

Install the following dependencies:

npm install class-variance-authority clsx tailwind-merge @phosphor-icons/react @floating-ui/react @internationalized/date @react-aria/calendar @react-aria/focus @react-aria/i18n @react-aria/interactions @react-stately/calendar @react-aria/button
2

Copy and paste the following code into your project.

Loading...
3

Update the import paths to match your project setup.

Update the import aliases (e.g. @/components, @/utils) in the copied files to match your project's path configuration.

Basic Usage

Single Date

import { useState } from 'react';
import { DatePicker } from '@versaui/ui/components/DatePicker';
import { today, getLocalTimeZone } from '@internationalized/date';
import type { DateValue } from '@internationalized/date';
function DatePickerExample() {
  const [date, setDate] = useState<DateValue | null>(null);
  return (
    <DatePicker
      value={date}
      onChange={setDate}
    />
  );
}

Date Range

import { useState } from 'react';
import { DateRangePicker } from '@versaui/ui/components/DatePicker';
import type { RangeValue, DateValue } from '@internationalized/date';
function DateRangeExample() {
  const [range, setRange] = useState<RangeValue<DateValue> | null>(null);
  return (
    <DateRangePicker
      value={range}
      onChange={setRange}
      showPresets={true}
    />
  );
}

Keyboard Navigation

KeyAction
Move to previous/next day
Move to previous/next week
EnterSelect the focused date
Page Up/DownMove to previous/next month
Shift + Page Up/DownMove to previous/next year

DateRangePreset Interface

interface DateRangePreset {
  id: string;
  label: string;
  getRange: (now: CalendarDate, locale: string) => RangeValue<CalendarDate>;
}
// Default presets: Today, This Week, This Month, This Year, Last Year, Custom

Accessibility

  • Full keyboard navigation for date selection
  • Proper ARIA labels and roles for screen readers
  • Focus management within the calendar grid
  • Disabled dates are announced and not selectable

DatePicker Props

PropTypeDefaultDescription
valueDateValue | nullControlled selected date.
defaultValueDateValue | nullDefault date for uncontrolled mode.
onChange(value: DateValue | null) => voidCallback when date changes.
onApply(value: DateValue | null) => voidCallback when Apply button clicked (confirm mode).
onCancel() => voidCallback when Cancel button clicked.
minValueDateValueMinimum selectable date.
maxValueDateValueMaximum selectable date.
isDateUnavailable(date: DateValue) => booleanFunction to mark specific dates unavailable.
commitBehavior'instant' | 'onApply''instant'Whether to commit immediately or require Apply button.
aria-labelstring'Select date'Accessible label for the calendar.
classNamestring''Additional CSS classes.

DateRangePicker Props

PropTypeDefaultDescription
showPresetsbooleantrueShow preset date ranges (Today, This Week, etc.).
presetsDateRangePreset[]DEFAULT_PRESETSCustom preset options.
valueRangeValue<DateValue> | nullControlled selected range.
defaultValueRangeValue<DateValue> | nullDefault range for uncontrolled mode.
onChange(value: RangeValue<DateValue> | null) => voidCallback when range changes.
onApply(value: RangeValue<DateValue> | null) => voidCallback when Apply button clicked (confirm mode).
onCancel() => voidCallback when Cancel button clicked.
minValueDateValueMinimum selectable date.
maxValueDateValueMaximum selectable date.
isDateUnavailable(date: DateValue) => booleanFunction to mark specific dates unavailable.
commitBehavior'instant' | 'onApply''instant'Whether to commit immediately or require Apply button.
aria-labelstring'Select date range'Accessible label for the calendar.
classNamestring''Additional CSS classes.

On this page