import { CalendarDate } from "@internationalized/date";
import { DatePicker } from "@senvenli/react/date";
export default function Example() {
// `timeZone` decides which day "Today" is: the warehouse's zone, not the visitor's device.
return <DatePicker label="Delivery date" defaultValue={new CalendarDate(2026, 3, 18)} timeZone="America/New_York" />;
}import { DatePicker } from "@senvenli/react/date";Examples
With a range
Days outside `minValue` and `maxValue` cannot be picked or typed.import { CalendarDate } from "@internationalized/date";
import { DatePicker } from "@senvenli/react/date";
export default function Example() {
return (
<DatePicker
label="Return by"
description="Returns are accepted for 30 days after delivery."
defaultValue={new CalendarDate(2026, 3, 25)}
minValue={new CalendarDate(2026, 3, 18)}
maxValue={new CalendarDate(2026, 4, 17)}
timeZone="America/New_York"
/>
);
}A month
For a report period: the popover is a grid of months.import { CalendarDate } from "@internationalized/date";
import { DatePicker } from "@senvenli/react/date";
export default function Example() {
return (
<DatePicker
label="Report month"
granularity="month"
defaultValue={new CalendarDate(2026, 3, 1)}
maxValue={new CalendarDate(2026, 3, 1)}
timeZone="America/New_York"
/>
);
}In Spanish
The locale names the months and days and orders the date; the label is yours.import { CalendarDate } from "@internationalized/date";
import { DesignSystemProvider } from "@senvenli/react";
import { DatePicker } from "@senvenli/react/date";
// Month and weekday names, the date order and the first day of the week come from the locale. The label is the
// app's own words; the library's few strings stay English until you register Spanish ones.
export default function Example() {
return (
<DesignSystemProvider locale="es-ES">
<DatePicker label="Fecha de entrega" defaultValue={new CalendarDate(2026, 3, 18)} timeZone="Europe/Madrid" />
</DesignSystemProvider>
);
}In Arabic, right to left
`dir="rtl"` mirrors the field and the calendar; digits follow the locale.import { CalendarDate } from "@internationalized/date";
import { DesignSystemProvider } from "@senvenli/react";
import { DatePicker } from "@senvenli/react/date";
// Right to left: the page (here a wrapper) sets dir="rtl". The field and the calendar mirror, the arrows point the
// reading way, and the digits follow the locale (ar-EG uses Arabic-Indic digits; ar-AE keeps Latin ones).
export default function Example() {
return (
<div dir="rtl" lang="ar">
<DesignSystemProvider locale="ar-EG">
<DatePicker label="تاريخ التسليم" defaultValue={new CalendarDate(2026, 3, 18)} timeZone="Africa/Cairo" />
</DesignSystemProvider>
</div>
);
}A range: A period
Start and end in one control over one calendar.import { CalendarDate } from "@internationalized/date";
import { DatePicker } from "@senvenli/react/date";
export default function Example() {
return (
<DatePicker selectionMode="range"
label="Report period"
defaultValue={{ start: new CalendarDate(2026, 3, 2), end: new CalendarDate(2026, 3, 18) }}
timeZone="America/New_York"
/>
);
}A range: With times
`granularity="hour"` adds a start and an end time.import { CalendarDateTime } from "@internationalized/date";
import { DatePicker } from "@senvenli/react/date";
export default function Example() {
return (
<DatePicker selectionMode="range"
label="Maintenance window"
description="Times are in the data center's zone."
granularity="hour"
defaultValue={{ start: new CalendarDateTime(2026, 3, 18, 22, 0), end: new CalendarDateTime(2026, 3, 19, 2, 30) }}
timeZone="America/New_York"
/>
);
}A range: Named halves and a total
Your own labels for the two halves, and a figure beside the day count under the calendar.import { useState } from "react";
import { CalendarDate } from "@internationalized/date";
import { DatePicker, type DateRangePickerValue } from "@senvenli/react/date";
const DAILY_BUDGET = 120;
const usd = new Intl.NumberFormat("en", { style: "currency", currency: "USD", maximumFractionDigits: 0 });
export default function Example() {
// The value is null while a half is empty or typed in part.
const [range, setRange] = useState<DateRangePickerValue | null>({ start: new CalendarDate(2026, 3, 18), end: new CalendarDate(2026, 3, 25) });
const days = range ? range.end.compare(range.start) : 0;
return (
<DatePicker selectionMode="range"
label="Campaign dates"
startLabel="First day"
endLabel="Last day"
value={range}
onChange={setRange}
minValue={new CalendarDate(2026, 3, 18)}
timeZone="America/New_York"
footer={days > 0 ? usd.format(days * DAILY_BUDGET) : undefined}
/>
);
}Guidelines
When to use it
- Picking a date where seeing the month helps.
- Picking a period: a stay, a trip, a report range.
Use something else when
- People type a known date, such as a birth date, and a calendar adds nothing. Date field
- The month grid stays visible on the page. Calendar
Accessibility
Keyboard
| Keys | What happens |
|---|---|
| Alt + Arrow down | Opens the calendar. |
Built in
- Unavailable days explain why.
- Required fields show "Fill in this field."; a partly typed date says what is missing.
- Both halves are labelled ("Start", "End") and typed independently.
- The range may not cross an unavailable day unless allowed.
You provide
- A visible label.
- A label for the range.
API reference
DatePicker
| Prop | Type | Default | Description |
|---|---|---|---|
defaultValue | CalendarDate | DateRangePickerValue | – | |
autoFocus | boolean | – | |
id | string | – | The id of the field's first typed segment (day, or the locale's first part), the element that takes focus : |
onBlur | (event: FocusEvent<Element, Element>) => void | – | |
onChange | (value: CalendarDate | null) => void | (value: DateRangePickerValue | null) => void | – | |
isDisabled | boolean | – | |
name | string | – | The form field name; the value is submitted as an ISO string. |
labelRequired | React.ReactNode | – | Always given; the label sits above the field and names its segments. |
description | React.ReactNode | – | |
errorMessage | React.ReactNode | – | What happened and what to do; shown when the field is invalid. |
isRequired | boolean | – | |
requiredValidation | RequiredValidation | – | Who says an empty required field is missing: |
isOptional | boolean | – | Shows "(optional)" when most of the form is required. |
isReadOnly | boolean | – | |
isInvalid | boolean | – | Marks the field invalid from outside (a server error); |
minValue | CalendarDate | DateValue | – | |
maxValue | CalendarDate | DateValue | – | |
validate | (value: CalendarDate | null) => string | true | string[] | null | undefined | (value: Span<DateValue> | null) => string | true | string[] | null | undefined | – | Your own check; return the message to show, or nothing when the date is fine. |
value | CalendarDate | DateRangePickerValue | – | A calendar date, no time zone; with While the user leaves a date typed in part or impossible ("31.aa.2026", "31.11.2026"), the field reports |
isDateUnavailable | (date: CalendarDate) => boolean | – | |
unavailableReason | (date: CalendarDate) => string | undefined | – | |
getDateMarkers | (date: CalendarDate) => DateMarker | undefined | – | |
firstDayOfWeek | FirstDayOfWeek | – | |
timeZone | string | – | "Today" in the calendar and the Today action: the location's zone; the device's by default. |
shouldCloseOnSelect | boolean | – | Close the calendar once a day is picked (default). |
granularity | "day" | "month" | "day" | "hour" | – |
|
selectionMode | "single" | "range" | – |
|
allowsNonContiguousRanges | boolean | – | |
startLabel | string | – | Overline labels of the two halves; "Start" and "End" by default. |
endLabel | string | – | |
footer | React.ReactNode | – | Right of the duration under the calendar: the price total ( |
startName | string | – | Form field names for the two halves (ISO strings). |
endName | string | – |
defaultValueCalendarDate | DateRangePickerValueautoFocusbooleanidstringThe id of the field's first typed segment (day, or the locale's first part), the element that takes focus :
document.getElementById(id).focus()puts the user in the field, as a focus-on-error does. The field's group gets an id of its own. Left out, the DOM is as before.onBlur(event: FocusEvent<Element, Element>) => voidonChange(value: CalendarDate | null) => void | (value: DateRangePickerValue | null) => voidisDisabledbooleannamestringThe form field name; the value is submitted as an ISO string.
labelRequiredReact.ReactNodeAlways given; the label sits above the field and names its segments.
descriptionReact.ReactNodeerrorMessageReact.ReactNodeWhat happened and what to do; shown when the field is invalid.
isRequiredbooleanrequiredValidationRequiredValidationWho says an empty required field is missing:
field(default) orapp. Withappa DS Form'sonSubmitruns with the field empty, and the app's own error must clear on change. See {@link RequiredValidation} for the whole contract.isOptionalbooleanShows "(optional)" when most of the form is required.
isReadOnlybooleanisInvalidbooleanMarks the field invalid from outside (a server error);
errorMessagesays why.minValueCalendarDate | DateValuemaxValueCalendarDate | DateValuevalidate(value: CalendarDate | null) => string | true | string[] | null | undefined | (value: Span<DateValue> | null) => string | true | string[] | null | undefinedYour own check; return the message to show, or nothing when the date is fine.
valueCalendarDate | DateRangePickerValueA calendar date, no time zone; with
granularity="month"the month's first day.While the user leaves a date typed in part or impossible ("31.aa.2026", "31.11.2026"), the field reports
onChange(null)and keeps the typed parts on screen, so settingnullchanges nothing: the value already is null. To clear the field (an app's own "Temizle" or form reset), give it a newkeyalong with the value: React remounts it empty, or at the value given.isDateUnavailable(date: CalendarDate) => booleanunavailableReason(date: CalendarDate) => string | undefinedgetDateMarkers(date: CalendarDate) => DateMarker | undefinedfirstDayOfWeekFirstDayOfWeektimeZonestring"Today" in the calendar and the Today action: the location's zone; the device's by default.
shouldCloseOnSelectbooleanClose the calendar once a day is picked (default).
granularity"day" | "month" | "day" | "hour"month: a year and a month, for a report or history range. The field types month and year (as DateFieldgranularity="month"), the value is that month's first day, and the popover is a grid of the twelve months under a year stepper, with "This month" and "Clear";minValueandmaxValuecount by month. The day-only props (unavailable days, markers, first day of the week) do not apply. Defaultday.selectionMode"single" | "range"single(default): one date (and time withgranularity="hour").allowsNonContiguousRangesbooleanstartLabelstringOverline labels of the two halves; "Start" and "End" by default.
endLabelstringfooterReact.ReactNodeRight of the duration under the calendar: the price total (
metric-small).startNamestringForm field names for the two halves (ISO strings).
endNamestring