Upgrading to v10
DayPicker v10 is mostly a cleanup release. If your app is already on v9 and
does not use deprecated v9 APIs, props, classNames, or styles keys, most of
the upgrade is package and import changes.
The main changes are:
- Deprecated v9 compatibility APIs were removed, including old prop names, aliases, and component slots.
- Deprecated
classNamesandstylescompatibility keys were removed.- shadcn/ui users with a copied
Calendarcomponent should also update their local class name mappings. See UpdateclassNamesandstyleskeys.
- shadcn/ui users with a copied
@daypicker/reactis the new preferred package name. Thereact-day-pickerpackage name remains available for compatibility.- The scoped package name gives us room to support multiple calendars and future Temporal API integrations under dedicated namespaces.
- 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/reactand update imports. - Replace deprecated API: if you use deprecated v9 props or APIs, replace them with the current names.
- Update
classNamesandstyleskeys: if you customize class names or inline styles, replace deprecated v9 keys. - 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
yarn remove react-day-picker
yarn add @daypicker/react
pnpm remove react-day-picker
pnpm add @daypicker/react
bun remove react-day-picker
bun add @daypicker/react
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
}}
/>
3. 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 |
<DayPicker
classNames={{
- table: "my-table",
- nav_button: "my-nav-button",
- day_selected: "my-selected",
+ month_grid: "my-table",
+ button_previous: "my-nav-button",
+ button_next: "my-nav-button",
+ selected: "my-selected"
}}
styles={{
- table: { borderCollapse: "collapse" },
+ month_grid: { borderCollapse: "collapse" }
}}
/>
If your app uses a copied Calendar component from shadcn/ui, update the
classNames mapping in that component too. Older generated Calendar components
may still use deprecated DayPicker v9 keys such as table, nav_button, and
day_selected.
Use the v10 keys shown above, and check whether your local component needs the latest shadcn/ui Calendar changes for dropdown captions. See shadcn-ui/ui#10441 for the related shadcn/ui Calendar template update.
4. 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.
Persian calendar
The old jalali import path now uses the Persian calendar package.
- npm
- Yarn
- pnpm
- Bun
npm install @daypicker/react @daypicker/persian
yarn add @daypicker/react @daypicker/persian
pnpm add @daypicker/react @daypicker/persian
bun add @daypicker/react @daypicker/persian
| 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 @daypicker/buddhist
yarn add @daypicker/react @daypicker/buddhist
pnpm add @daypicker/react @daypicker/buddhist
bun add @daypicker/react @daypicker/buddhist
| Removed import | Use instead |
|---|---|
react-day-picker/buddhist | @daypicker/buddhist |
Ethiopic calendar
- npm
- Yarn
- pnpm
- Bun
npm install @daypicker/react @daypicker/ethiopic
yarn add @daypicker/react @daypicker/ethiopic
pnpm add @daypicker/react @daypicker/ethiopic
bun add @daypicker/react @daypicker/ethiopic
| 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 @daypicker/hebrew
yarn add @daypicker/react @daypicker/hebrew
pnpm add @daypicker/react @daypicker/hebrew
bun add @daypicker/react @daypicker/hebrew
| Removed import | Use instead |
|---|---|
react-day-picker/hebrew | @daypicker/hebrew |
Hijri calendar
- npm
- Yarn
- pnpm
- Bun
npm install @daypicker/react @daypicker/hijri
yarn add @daypicker/react @daypicker/hijri
pnpm add @daypicker/react @daypicker/hijri
bun add @daypicker/react @daypicker/hijri
| Removed import | Use instead |
|---|---|
react-day-picker/hijri | @daypicker/hijri |
Deprecated aliases from types/deprecated were also removed.