Upgrading to v10
DayPicker v10 is mostly a cleanup release. If your app is already on v9 and does not use APIs or props deprecated in v9, most of the upgrade is package and import changes.
The main changes are:
- APIs and props deprecated in v9 were removed.
@daypicker/reactis the new preferred package name. Thereact-day-pickerpackage name remains available for compatibility.- Non-Gregorian calendars moved to separate add-on packages. If you use imports
such as
react-day-picker/hebrew,react-day-picker/hijri, orreact-day-picker/persian, install the matching add-on package.
If you are upgrading directly from v8, use the v8 to v10 upgrade guide instead.
Upgrade checklist
- Upgrade the package: replace
react-day-pickerwith@daypicker/react@nextand update imports. - Replace deprecated API: if you use deprecated v9 props or APIs, replace them with the current names.
- Update non-Gregorian package imports: if you use a non-Gregorian calendar, install the matching add-on package and update the calendar imports.
If your app has a local Calendar or DatePicker wrapper, update its
DayPicker imports, props, and styles before checking the screens that use it.
1. Upgrade the package
The recommended v10 package name is @daypicker/react. Remove the previous
react-day-picker dependency, then install the package under its preferred
name:
- npm
- Yarn
- pnpm
- Bun
npm remove react-day-picker
npm install @daypicker/react@next
yarn remove react-day-picker
yarn add @daypicker/react@next
pnpm remove react-day-picker
pnpm add @daypicker/react@next
bun remove react-day-picker
bun add @daypicker/react@next
The react-day-picker package name remains available in v10 for compatibility,
so existing imports can still work. Use @daypicker/react for new projects and
upgraded imports.
- import { DayPicker } from "react-day-picker";
- import "react-day-picker/style.css";
+ import { DayPicker } from "@daypicker/react";
+ import "@daypicker/react/style.css";
Locale imports move the same way:
- import { es } from "react-day-picker/locale";
+ import { es } from "@daypicker/react/locale";
2. Replace deprecated API
If your app still uses APIs or props deprecated in v9, replace them with the current names below. The deprecated names were removed in v10.
Replace removed navigation props
| Removed prop | Use instead |
|---|---|
fromMonth | startMonth |
fromYear | startMonth with the first month of that year |
toMonth | endMonth |
toYear | endMonth with the last month of that year |
fromDate | hidden with a before matcher, and optionally startMonth |
toDate | hidden with an after matcher, and optionally endMonth |
<DayPicker
- fromYear={2010}
- toYear={2021}
+ startMonth={new Date(2010, 0)}
+ endMonth={new Date(2021, 11)}
/>
<DayPicker
- fromDate={new Date(2010, 11, 3)}
+ startMonth={new Date(2010, 11)}
+ hidden={{ before: new Date(2010, 11, 3) }}
/>
<DayPicker
- toDate={new Date(2010, 11, 3)}
+ endMonth={new Date(2010, 11)}
+ hidden={{ after: new Date(2010, 11, 3) }}
/>
Replace removed focus and event props
| Removed prop | Use instead |
|---|---|
initialFocus | autoFocus |
onWeekNumberClick | A custom WeekNumber component |
onDayKeyUp | A custom DayButton component |
onDayKeyPress | A custom DayButton component |
onDayPointerEnter | A custom DayButton component |
onDayPointerLeave | A custom DayButton component |
onDayTouchCancel | A custom DayButton component |
onDayTouchEnd | A custom DayButton component |
onDayTouchMove | A custom DayButton component |
onDayTouchStart | A custom DayButton component |
For week-based selections, follow the week selection example.
For extra DOM event handlers on each day, compose around the default
DayButton in the
Custom Components guide.
Replace removed aliases
| Removed API | Use instead |
|---|---|
formatMonthCaption | formatCaption |
formatYearCaption | formatYearDropdown |
labelDay | labelDayButton |
labelCaption | labelGrid |
isMatch | dateMatchModifiers |
isDateInRange | rangeIncludesDate |
If you already migrated to the v9 names, there is nothing to change here.
Replace components.Button
The deprecated components.Button entry was removed in v10.
Use
PreviousMonthButton and
NextMonthButton instead.
<DayPicker
components={{
- Button: MyButton
+ PreviousMonthButton: MyPreviousButton,
+ NextMonthButton: MyNextButton
}}
/>
Update classNames and styles keys
The deprecated compatibility keys were removed from classNames and styles.
Use only the current keys from
UI,
DayFlag,
SelectionState, and
Animation.
Common migrations:
| Removed key | Use instead |
|---|---|
table | month_grid |
nav_button | button_previous and button_next |
day_selected | selected |
day_disabled | disabled |
3. Update non-Gregorian package imports
The calendar packages are now published separately from the main React package.
Install the add-on package you use alongside @daypicker/react@next.
Persian calendar
The old jalali import path now uses the Persian calendar package.
- npm
- Yarn
- pnpm
- Bun
npm install @daypicker/react@next @daypicker/persian@next
yarn add @daypicker/react@next @daypicker/persian@next
pnpm add @daypicker/react@next @daypicker/persian@next
bun add @daypicker/react@next @daypicker/persian@next
| Removed import | Use instead |
|---|---|
react-day-picker/jalali | @daypicker/persian |
react-day-picker/persian | @daypicker/persian |
enUSJalali from react-day-picker/locale | enUSJalali from @daypicker/persian |
faIRJalali from react-day-picker/locale | faIRJalali from @daypicker/persian |
Buddhist calendar
- npm
- Yarn
- pnpm
- Bun
npm install @daypicker/react@next @daypicker/buddhist@next
yarn add @daypicker/react@next @daypicker/buddhist@next
pnpm add @daypicker/react@next @daypicker/buddhist@next
bun add @daypicker/react@next @daypicker/buddhist@next
| Removed import | Use instead |
|---|---|
react-day-picker/buddhist | @daypicker/buddhist |
Ethiopic calendar
- npm
- Yarn
- pnpm
- Bun
npm install @daypicker/react@next @daypicker/ethiopic@next
yarn add @daypicker/react@next @daypicker/ethiopic@next
pnpm add @daypicker/react@next @daypicker/ethiopic@next
bun add @daypicker/react@next @daypicker/ethiopic@next
| Removed import | Use instead |
|---|---|
react-day-picker/ethiopic | @daypicker/ethiopic |
amET from react-day-picker/locale | amET from @daypicker/ethiopic |
Hebrew calendar
- npm
- Yarn
- pnpm
- Bun
npm install @daypicker/react@next @daypicker/hebrew@next
yarn add @daypicker/react@next @daypicker/hebrew@next
pnpm add @daypicker/react@next @daypicker/hebrew@next
bun add @daypicker/react@next @daypicker/hebrew@next
| Removed import | Use instead |
|---|---|
react-day-picker/hebrew | @daypicker/hebrew |
Hijri calendar
- npm
- Yarn
- pnpm
- Bun
npm install @daypicker/react@next @daypicker/hijri@next
yarn add @daypicker/react@next @daypicker/hijri@next
pnpm add @daypicker/react@next @daypicker/hijri@next
bun add @daypicker/react@next @daypicker/hijri@next
| Removed import | Use instead |
|---|---|
react-day-picker/hijri | @daypicker/hijri |
Deprecated aliases from types/deprecated were also removed.