Skip to main content

Type Alias: DayPickerContext<T>

DayPickerContext<T>: { classNames: ClassNames; components: CustomComponents; dayPickerProps: DayPickerProps; formatters: Formatters; getModifiers: (day) => Modifiers; goToMonth: (month) => void; isSelected: (date) => boolean | undefined; labels: Labels; months: CalendarMonth[]; nextMonth: Date | undefined; previousMonth: Date | undefined; select: SelectHandler<T> | undefined; selected: SelectedValue<T> | undefined; styles: Partial<Styles> | undefined; }

Represents the context for the DayPicker component, providing various properties and methods to interact with the calendar.

Type Parameters

Type ParameterDescription
T extends { mode: Mode; required: boolean; }The type of the DayPicker props, which must optionally include mode and required properties. This type can be used to refine the type returned by the hook.

Type declaration

NameTypeDescription
classNamesClassNamesThe class names for the UI elements.
componentsCustomComponentsThe components used internally by DayPicker.
dayPickerPropsDayPickerPropsThe props as passed to the DayPicker component. Since 9.3.0
formattersFormattersThe formatters used to format the UI elements.
getModifiers(day) => ModifiersReturns the modifiers for the given day.
goToMonth(month) => voidNavigate to the specified month. Will fire the onMonthChange callback.
isSelected(date) => boolean | undefinedWhether the given date is selected.
labelsLabelsThe labels used in the user interface.
monthsCalendarMonth[]The months displayed in the calendar.
nextMonthDate | undefinedThe next month to display.
previousMonthDate | undefinedThe previous month to display.
selectSelectHandler<T> | undefinedSet a selection.
selectedSelectedValue<T> | undefinedThe selected date(s).
stylesPartial<Styles> | undefinedThe styles for the UI elements.

Defined in

src/useDayPicker.ts:34