--- sidebar_position: 5 --- # Upgrading to v9 This release includes significant updates related to accessibility, styles, internationalization, and performance. See the [changelog](./changelog.mdx) for the full list of changes. ## Upgrading from v7 If you are upgrading from v7, this guide is still valid. First, read the [migration guide from v7 to v8](../versioned_docs/version-8.10.1/upgrading.mdx), then follow the steps below. ## Checklist ### 1. Upgrade to the Latest Version ```bash npm2yarn npm install react-day-picker@latest ``` If you are not using `date-fns` directly in your code (e.g., when using a [different locale](./localization/changing-locale.mdx)), remove it from your dependencies: ```bash npm2yarn npm remove date-fns ``` ### 2. Update Your Custom Styles The default design has changed slightly. You may need to adjust DayPicker to match your design. See the [styling docs](./docs/styling.mdx) for more information. ### 3. Add the `onSelect` Prop When Using `selected` The `selected` prop is now controlled. Add an `onSelect` prop to handle the selected state and keep it in sync with your component. ```diff + const [selected, setSelected] = useState(undefined); ``` ### 4. Update Class Names Class names for UI elements have been updated for clarity and consistency. If you use custom styles via the `classNames` or `styles` prop, update them accordingly. For example, `day_disabled` is now `disabled`: ```diff ``` Additionally, the `day` element is now `day_button`, and the `cell` element is now `day`: ```diff ``` See the full list of updated class names in the [`DeprecatedUI`](./api/type-aliases/DeprecatedUI.md) type.
**List of Updated Class Names** | Old Name | New Name | | --------------------- | ---------------------------------------------------------- | | `button` | `button_previous`, `button_next` | | `button_reset` | `button_previous`, `button_next` | | `caption` | `month_caption` | | `caption_between` | Removed | | `caption_dropdowns` | `dropdowns` | | `caption_end` | Removed | | `caption_start` | Removed | | `cell` | `day` – ⚠️ The previous `day` element is now `day_button`. | | `day_disabled` | `disabled` | | `day_hidden` | `hidden` | | `day_outside` | `outside` | | `day_range_end` | `range_end` | | `day_range_middle` | `range_middle` | | `day_range_start` | `range_start` | | `day_selected` | `selected` | | `day_today` | `today` | | `dropdown_icon` | `chevron` | | `dropdown_month` | `months_dropdown` | | `dropdown_year` | `years_dropdown` | | `head` | Removed | | `head_cell` | `weekday` | | `head_row` | `weekdays` | | `multiple_months` | Removed. Use `data-multiple-months` data attribute. | | `nav_button` | `button_previous`, `button_next` | | `nav_button_next` | `button_next` | | `nav_button_previous` | `button_previous` | | `nav_icon` | `chevron`, `button_next`, `button_previous` | | `row` | `week` | | `table` | `month_grid` | | `tbody` | `weeks` | | `tfoot` | `footer` | | `vhidden` | Removed | | `weeknumber` | `week_number` | | `with_weeknumber` | Removed. Use `data-week-numbers` data attribute. |
### 5. Replace `fromDate` and `toDate` Replace `fromDate` and `toDate` with the `hidden`, `startMonth`, and `endMonth` props. #### Example: Replace `fromDate` ```diff