A calendar overlay for selecting a date, date range, or dual date.
Loading demo: datepicker-real-world
npx sdaia-ui@latest add datepicker
import { DatePicker } from '@/components/ui/DatePicker';1<DatePicker2onSubmit={(val) => console.log('Submit:', val)}3onCancel={() => console.log('Cancel')}4showHijri5type='withSidepanel'6/>
Use surface="glass" to enable Glass Effect on Date Picker
Loading demo: date-picker-glass
Use `type="withSidepanel"` to show the calendar with a side panel.
Loading demo: date-picker-default
Add `range` to select a start and an end date.
Loading demo: date-picker-range
The default Gregorian Date picker.
Loading demo: date-picker-gregorian
The default Gregorian+Hijri Date picker.
Loading demo: date-picker-gregorian-hijri
The default single-date picker.
Loading demo: date-picker-single
Props for the DatePicker component.
Prop | Type | Default | Required |
|---|---|---|---|
dir | "ltr" | "rtl" | — | optional |
type | 'default' | 'withSidepanel' | 'default' | optional |
single | boolean | false | optional |
showHijri | boolean | false | optional |
mobile | boolean | — | optional |
range | boolean | — | optional |
value | Date | null | — | optional |
rangeValue | DateRange | — | optional |
defaultValue | Date | null | — | optional |
defaultRangeValue | DateRange | — | optional |
onChange | (date: Date | null) => void | — | optional |
onRangeChange | (range: DateRange) => void | — | optional |
onSubmit | (value: DateRange) => void | — | optional |
onCancel | () => void | — | optional |
showDateInputs | boolean | true | optional |
showSecondMonth | boolean | !single | optional |
minDate | Date | — | optional |
maxDate | Date | — | optional |
labels | Partial<DatePickerLabels> | English strings | optional |
presetFooter | ReactNode | — | optional |
locale | string | — | optional |
calendar | "hijri" | "hijri-gregorian" | "gregorian" | "gregorian-hijri" | "hijri" | optional |
How this component behaves at the three system breakpoints. Spacing and type tokens switch automatically at 768px and 1280px.
| Screen | Behavior |
|---|---|
| Desktop (1280px and up) | Full calendar with presets and, in range mode, two months side by side. |
| Tablet (768–1279px) | From 1024px: the desktop calendar. Below 1024px: switches automatically to the compact layout (one month, up to 352px wide, presets as scrolling chips). |
| Phone (under 768px) | Compact layout: one month that shrinks to the screen width. Set mobile to force either layout. |