Skip to main content

Function: useDayPicker()

useDayPicker<T>(): DayPickerContext<T>

Returns the context to work with <DayPicker /> inside custom components.

This hook provides access to the DayPicker context, which includes various properties and methods to interact with the DayPicker component. It must be used within a custom component.

Type Parameters​

Type ParameterDescription
T extends {mode: Mode;required: boolean; }Use this type to refine the returned context type with a specific selection mode.

Returns​

DayPickerContext<T>

The context to work with DayPicker.

Throws​

If the hook is used outside of a DayPicker provider.

See​

https://daypicker.dev/guides/custom-components

Defined in​

src/useDayPicker.ts:85