Skip to main content
Version: 1.0.3

Date Picker

Overview

The DatePicker component is a flexible and feature-rich date selection component that supports both single date selection and date range selection. It includes multiple themes, color schemes, animations, and extensive customization options.

Installation

ignix add component date-picker

Previews

Basic Date Picker

Choose your appointment date

Range Date Picker

Choose start and end dates

Size Variants

Small

Medium (Default)

Large

Extra Large

Color Schemes

Theme Mode

Blue

Green

Purple

Orange

Slate

Rose

Bottom Left

Bottom Right

Top Left

Top Right

Left

Right

💡 Tip: The popup position automatically adjusts on small screens to ensure calendar visibility

Controlled & Uncontrolled

The DatePicker can be used in both controlled and uncontrolled modes:

Hotel Booking Example

Choose check-in and check-out dates (weekends are unavailable)

Features demonstrated:

  • Date range selection
  • Min/max date constraints
  • Disabled dates (weekends)
  • Today and Clear buttons
  • Custom date format (MMM DD, YYYY)

Validation Examples

Required Field

This field must be filled

Min/Max Date Constraints

Dates between 1/21/2026 and 1/28/2026

Disabled Dates

2nd and 4th from today are unavailable

Error State

Invalid date selected

Date Picker Playground

Customize the DatePicker and see changes in real-time

Variant

Size

Color Scheme

Popup Position

Interactive playground - customize using controls above

Controlled Usage

Single Date Picker

Date is controlled by React state

Selected: No date selected

Range Date Picker

Range is controlled by React state

Selected Range:

Start: Not selected

End: Not selected

Props

Core Props

PropTypeDefaultDescription
variant'single' | 'range''single'Date selection mode
valueDate | DateRange-Selected date(s)
onChange`(date: DateDateRange) => void`-
onError`(error: stringnull) => void`-

Configuration

PropTypeDefaultDescription
placeholderstring '| [string, string]'Select date'Input placeholder text
formatDateFormat'MM/DD/YYYY'Date display format
size'sm' | 'md' | 'lg' | 'xl''md'Component size
disabledbooleanfalseDisable the date picker
readOnlybooleanfalseMake the input read-only
requiredbooleanfalseMake selection required
minDateDate-Minimum selectable date
maxDateDate-Maximum selectable date
disabledDatesDate[]-Array of disabled dates
highlightDatesDate[]-Array of highlighted dates
allowEmptybooleanfalseAllow clearing selected date
todayButtonbooleantrueShow "Today" button in calendar
clearButtonbooleantrueShow "Clear" button in calendar
autoClosebooleanfalseAuto-close calendar after selection
validateOnChangebooleantrueValidate on date change

Styling & UI

PropTypeDefaultDescription
themeMode'light' | 'dark''light'Theme mode
colorScheme'blue' | 'green' | 'purple' | 'orange' | 'rose' 'blue'Color scheme
popupPositionPopupPosition'bottom-left'Calendar popup position
showIconbooleantrueShow calendar icon
iconReact.ReactNode<Calendar />Custom icon component
classNamestring-Container CSS classes
inputClassNamestring-Input CSS classes
calendarClassNamestring-Calendar CSS classes
labelstring-Input label
helperTextstring-Helper text below input

Validation & Error

PropTypeDefaultDescription
errorbooleanfalseError state
errorMessagestring-Error message to display

Internationalization

PropTypeDefaultDescription
weekStart0 | 10Week start day (0=Sunday, 1=Monday)
monthNamesstring[]MONTH_NAMESCustom month names
dayNamesstring[]DAY_NAMESCustom day names
todayTextstring'Today'Today button text
clearTextstring'Clear'Clear button text

Date Formats

FormatExampleDescription
MM/DD/YYYY12/25/2024Month/Day/Year
DD/MM/YYYY25/12/2024Day/Month/Year
YYYY-MM-DD2024-12-25ISO format
MMM DD, YYYYDec 25, 2024Short month name
DD MMM YYYY25 Dec 2024Day with short month
YYYY/MM/DD2024/12/25Year/Month/Day
PositionDescription
bottom-leftBelow the input, aligned left
bottom-rightBelow the input, aligned right
top-leftAbove the input, aligned left
top-right Above the input, aligned right
leftTo the left of the input
rightTo the right of the input