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; }

Defined in: src/useDayPicker.ts:34

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.

Properties

classNames

classNames: ClassNames

Defined in: src/useDayPicker.ts:56

The class names for the UI elements.


components

components: CustomComponents

Defined in: src/useDayPicker.ts:54

The components used internally by DayPicker.


dayPickerProps

dayPickerProps: DayPickerProps

Defined in: src/useDayPicker.ts:68

The props as passed to the DayPicker component.

Since

9.3.0


formatters

formatters: Formatters

Defined in: src/useDayPicker.ts:62

The formatters used to format the UI elements.


getModifiers()

getModifiers: (day) => Modifiers

Defined in: src/useDayPicker.ts:46

Returns the modifiers for the given day.

Parameters

ParameterType
dayCalendarDay

Returns

Modifiers


goToMonth()

goToMonth: (month) => void

Defined in: src/useDayPicker.ts:44

Navigate to the specified month. Will fire the onMonthChange callback.

Parameters

ParameterType
monthDate

Returns

void


isSelected

isSelected: (date) => boolean | undefined

Defined in: src/useDayPicker.ts:52

Whether the given date is selected.


labels

labels: Labels

Defined in: src/useDayPicker.ts:60

The labels used in the user interface.


months

months: CalendarMonth[]

Defined in: src/useDayPicker.ts:38

The months displayed in the calendar.


nextMonth

nextMonth: Date | undefined

Defined in: src/useDayPicker.ts:40

The next month to display.


previousMonth

previousMonth: Date | undefined

Defined in: src/useDayPicker.ts:42

The previous month to display.


select

select: SelectHandler<T> | undefined

Defined in: src/useDayPicker.ts:50

Set a selection.


selected

selected: SelectedValue<T> | undefined

Defined in: src/useDayPicker.ts:48

The selected date(s).


styles

styles: Partial<Styles> | undefined

Defined in: src/useDayPicker.ts:58

The styles for the UI elements.