Directory
- Welcome
Date Picker Component
The DatePicker component provides an intuitive interface for date selection with a calendar popup. It features smooth animations, keyboard navigation, and comprehensive accessibility support.
Key Features
-
Calendar Interface: Visual date selection with month navigation
-
Date Formatting: Flexible date format options
-
Range Constraints: Optional min/max date limitations
-
Keyboard Support: Full keyboard navigation and accessibility
-
Today Highlighting: Visual indicator for current date
Basic Usage
Create a simple date picker with default settings:
<DatePicker />
With Initial Value and Modes
Specify initial date and modes:
<DatePicker calendarProps={{ value: new Date() }}/>
<DatePicker calendarProps={{ value: { start: new Date(2025, 1, 1), end: new Date(2025, 1, 10) }, mode: 'range', }}/>
<DatePicker calendarProps={{ value: [new Date(2025, 1, 1), new Date(2025, 1, 3)], mode: 'multiple', }}/>
DatePicker Component Props API
Prop | Type | Default | Description |
---|---|---|---|
placeholder | string | Select date | Input placeholder text |
calendarProps | CalendarProps | Calendar component props | |
closeOnSelect | boolean | true | Close the popover after selecting a date (Unless mode is multiple) |
Common Applications
Form Inputs
Date Selection
Range Selection
Limited Time Launch Sale
Create intuitive date selection interfaces with our pre-built DatePicker component. Get the AstroJS starter template now and implement professional date picking instantly.
GET 60% OFF!