<Calendar
defaultValue="2024-01-15"
defaultFocusedDate="2024-01-01"
defaultTimeZone="America/New_York"
focusedDate="2024-01-15"
maxDate="2024-12-31"
minDate="2024-01-01"
unavailable={{ dates: ["2024-01-20", "2024-01-21"]}}
value="2024-01-15"
/>
Calendar Props
Props marked as BETA are currently only available if you import from @servicetitan/anvil2/beta.
dateMetaData
{ date: string, context: string }[]
BETA Array of date metadata objects to display pips and provide context.
defaultTimeZone
IanaZone
default:"Local browser timezone"
defaultValue
string | { start?: string; end?: string }
Uncontrolled date value. Object is only accepted when range={true}.
locale
Locale
default:"Browser locale"
The locale to use for the calendar.
onMonthView
({ month, year }: { month: number, year: number }) => void
BETA Callback when the visible month changes.
onSelection
(data: { value }) => void
Callback when a date is selected.
Enable date range selection mode. When true, value and defaultValue accept objects with start and end properties.
startDay
"Sunday" | "Monday"
default:"Sunday"
The day of the week to start the calendar on.
unavailable
{ daysOfWeek?: WeekdayNumbers[]; dates?: string[] }
The days of the week and specific dates that are unavailable.
value
string | { start?: string; end?: string }
Controlled date value. Object is only accepted when range={true}.