Date Picker

A calendar-based date selection component with support for constraints, custom formatting, and validation states.

Basic Date Picker

With Default Value

Today is pre-selected

With Helper Text

Select your preferred appointment date

States

Date Constraints

Cannot select dates before tomorrow

Must be at least 18 years old

Available for next 7 days only

Disabled Specific Dates

Weekends are disabled

Custom Date Format

Clear Button

Click X to clear the selected date

Date cannot be cleared

Required Field

This field is required

Props

NameTypeDefaultDescription
label*string-Date picker label text
placeholderstring'Pick a date'Placeholder text when no date selected
valueDate | null-Controlled date value
defaultValueDate-Uncontrolled default date
dateFormatstring'PPP'Date format string (date-fns format)
minDateDate-Minimum selectable date
maxDateDate-Maximum selectable date
disabledDatesDate[][]Array of specific dates to disable
showClearButtonbooleantrueShow X button to clear selected date
disabledbooleanfalseWhether date picker is disabled
requiredbooleanfalseWhether date is required (shows * indicator)
errorstring-Error message to display
helperTextstring-Helper text below date picker
onChange(date: Date | null) => void-Callback when date changes
onBlur() => void-Callback when picker loses focus

Usage Guidelines

When to use

  • For selecting single dates in forms (appointments, birthdays, deadlines)
  • When users need a visual calendar to help them choose dates
  • When date constraints need to be clearly communicated (min/max dates)
  • When specific dates need to be disabled (weekends, holidays, blocked dates)

Best practices

  • Use clear labels that indicate what the date represents
  • Provide helper text to clarify date constraints or format requirements
  • Use minDate/maxDate to prevent selection of invalid dates
  • Show clear button for optional date fields
  • Use appropriate date format for your locale and context
  • Disable the picker when the field is not editable in current context

Accessibility

  • Keyboard accessible (Tab, Arrow keys, Enter, Escape)
  • ARIA attributes: aria-invalid, aria-describedby, aria-required
  • Error messages announced with aria-live
  • Focus indicators visible on trigger and calendar
  • Label properly associated with date picker
  • Calendar navigation with arrow keys for date selection
  • Disabled dates clearly indicated visually and programmatically
  • Selected date highlighted with distinct styling

Do's and Don'ts

Do

  • Use date constraints (minDate/maxDate) to prevent invalid selections
  • Provide clear helper text explaining date requirements
  • Use appropriate date format for your locale
  • Show clear button for optional date fields
  • Disable specific dates when they're unavailable (weekends, holidays)

Available dates start tomorrow

Don't

  • Don't allow selection of invalid dates without constraints
  • Don't use vague labels like "Date" or "Pick date"
  • Don't use date picker for very distant past dates (use text input)
  • Don't hide date format requirements - show them in helper text
  • Don't force users to clear required date fields

Related Components

Resources