Date Picker

Forms
Date

Calendar-based date selection with month/year navigation, today indicator, and quick-select button. Ideal for forms requiring single date input.

Preview

Basic date picker with placeholder

With Label

Date picker with form label

With Default Value

Pre-selected date

Disabled State

Date picker in disabled state

Props

DatePicker component API reference

PropTypeDefaultDescription
valueDate | nullSelected date value
onChange(date: Date | null) => voidCallback when date is selected
labelstringLabel text above the picker
placeholderstring'Select date'Placeholder when no date selected
disabledbooleanfalseDisable the date picker
classNamestringAdditional CSS classes

Usage

Import and implementation example

import { DatePicker } from '@/components/ui/date-picker'

export default function Example() {
  const [date, setDate] = useState<Date | null>(null)

  return (
    <>
      {/* Basic usage */}
      <DatePicker
        label="Select Date"
        value={date}
        onChange={setDate}
        placeholder="Pick a date"
      />

      {/* With default value */}
      <DatePicker
        label="Appointment"
        value={new Date()}
        onChange={setDate}
      />
    </>
  )
}

Features

Built-in functionality

  • Calendar view: Full month calendar with 6-week display
  • Month navigation: Previous/next month buttons
  • Today indicator: Current date highlighted with border
  • Today button: Quick-select button to jump to today
  • Selected date highlight: Visual indicator for selected date
  • Click outside to close: Dropdown closes on outside click
  • Localized format: Date displayed in locale format
  • Dark mode: Full dark mode support

Accessibility

Accessibility considerations

ARIA Attributes

Trigger button is focusable and activates calendarCalendar dates are navigable buttonsSelected date indicated visually and programmatically

Keyboard Navigation

KeyAction
TabFocus trigger button
Enter / SpaceOpen calendar / Select date
EscapeClose calendar

Notes

  • Calendar icon provides visual affordance
  • Today highlighted with distinct border
  • Non-current month dates shown in muted color
  • Selected date shows filled background