API reference docs for the component. Learn about the props, CSS, and other APIs of this
exported module.
The document's text/writing direction.
Whether the calendar is disabled.
Whether the calendar should have a fixed number of weeks.
This renders the calendar with 6 weeks instead of 5 or 6.
format
(date: DateValue[]) => string
The format of the date to display in the input.
getRootNode
() => ShadowRoot | Node | Document
A root node to correctly resolve document in custom environments. E.x.: Iframes, Electron.
The unique identifier of the machine.
ids
Partial<{ grid(id: string): string; header: string; content: string; cellTrigger(id: string): string; prevTrigger(view: DateView): string; nextTrigger(view: DateView): string; ... 7 more ...; positioner: string; }>
The ids of the elements in the date picker. Useful for composition.
Whether the calendar should be displayed inline.
isDateUnavailable
(date: DateValue, locale: string) => boolean
Returns whether a date of the calendar is available.
The locale (BCP 47 language tag) to use when formatting the date.
The maximum date that can be selected.
The localized messages to use.
The minimum date that can be selected.
Whether the calendar should be modal. This means that the calendar will
block interaction with the rest of the page, and trap focus within it.
The `name` attribute of the input element.
The number of months to display.
onFocusChange
(details: FocusChangeDetails) => void
Function called when the focused date changes.
onOpenChange
(details: OpenChangeDetails) => void
Function called when the calendar opens or closes.
onValueChange
(details: ValueChangeDetails) => void
Function called when the value changes.
onViewChange
(details: ViewChangeDetails) => void
Function called when the view changes.
parse
(value: string) => DateValue[]
The format of the date to display in the input.
positioning
PositioningOptions
The user provided options used to position the date picker content
Whether the calendar is read-only.
selectionMode
SelectionMode
The selection mode of the calendar.
- `single` - only one date can be selected
- `multiple` - multiple dates can be selected
- `range` - a range of dates can be selected
The first day of the week.
`0` - Sunday
`1` - Monday
`2` - Tuesday
`3` - Wednesday
`4` - Thursday
`5` - Friday
`6` - Saturday
clearTriggerProps
Dict<any>
Clears the selected date(s).
Function to close the calendar.
The focused date as a Date object.
focusedValueAsString
string
The focused date as a string.
focusMonth
(month: number) => void
Function to set the selected month.
focusYear
(year: number) => void
Function to set the selected year.
format
(value: CalendarDate, opts?: DateTimeFormatOptions | undefined) => string
Formats the given date value based on the provided options.
getDayCellProps
(props: DayCellProps) => Dict<any>
getDayCellState
(props: DayCellProps) => DayCellState
Returns the state details for a given cell.
getDayCellTriggerProps
(props: DayCellProps) => Dict<any>
getDaysInWeek
(weekIndex: number, from?: DateValue | undefined) => DateValue[]
Returns an array of days in the week index counted from the provided start date, or the first visible date if not given.
getDecade
() => { start: number | undefined; end: number | undefined }
Returns the start and end years of the decade.
getGridProps
(props?: GridProps | undefined) => Dict<any>
getHeaderProps
(props?: ViewProps | undefined) => Dict<any>
getMonthCellProps
(props: CellProps) => Dict<any>
getMonthCellState
(props: CellProps) => CellState
Returns the state details for a given month cell.
getMonthCellTriggerProps
(props: CellProps) => Dict<any>
getMonthDays
(from?: DateValue | undefined) => DateValue[][]
Returns the weeks of the month from the provided date. Represented as an array of arrays of dates.
getMonths
(props?: { format?: 'short' | 'long' | undefined } | undefined) => GridItem[]
Returns the months of the year
getMonthsGrid
(props?: MonthGridProps | undefined) => MonthGridValue
Returns the months of the year based on the columns.
Represented as an array of arrays of months.
getNextTriggerProps
(props?: ViewProps | undefined) => Dict<any>
getOffset
(months: number) => {
amount: number
visibleRange: {
start: CalendarDate | CalendarDateTime | ZonedDateTime
end: CalendarDate | CalendarDateTime | ZonedDateTime
}
weeks: DateValue[][]
}
Returns the offset of the month based on the provided number of months.
getPrevTriggerProps
(props?: ViewProps | undefined) => Dict<any>
getViewTriggerProps
(props?: ViewProps | undefined) => Dict<any>
getYearCellProps
(props: CellProps) => Dict<any>
getYearCellState
(props: CellProps) => CellState
getYearCellTriggerProps
(props: CellProps) => Dict<any>
Returns the months of the year
getYearsGrid
(props?: YearGridProps | undefined) => YearGridValue
Returns the years of the decade based on the columns.
Represented as an array of arrays of years.
Goes to the next month/year/decade.
Goes to the previous month/year/decade.
Whether the input is focused
isUnavailable
(date: DateValue) => boolean
Returns whether the provided date is available (or can be selected)
monthSelectProps
Dict<any>
Function to open the calendar.
Sets the selected date to today.
setFocusedValue
(value: CalendarDate) => void
Sets the focused date to the given date.
setValue
(values: CalendarDate[]) => void
Sets the selected date to the given date.
setView
(view: DateView) => void
Sets the view of the date picker.
The selected date as a Date object.
The selected date as a string.
The current view of the date picker
visibleRange
{ start: DateValue; end: DateValue }
The visible range of dates.
visibleRangeText
{ start: string; end: string; formatted: string }
The human readable text for the visible range of dates.
weekDays
{
value: CalendarDate | CalendarDateTime | ZonedDateTime
short: string
long: string
narrow: string
}[]
The days of the week. Represented as an array of strings.
The weeks of the month. Represented as an array of arrays of dates.
Whether the date picker is open