You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/data/migration/migration-pickers-v5/migration-pickers-v5.md
+28-14Lines changed: 28 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
<pclass="description">This guide describes the changes needed to migrate the Date and Time Pickers from v5 to v6.</p>
4
4
5
-
## Start using the alpha release
5
+
## Start using the prerelease
6
6
7
7
In `package.json`, change the version of the date pickers package to `next`.
8
8
@@ -11,7 +11,7 @@ In `package.json`, change the version of the date pickers package to `next`.
11
11
+"@mui/x-date-pickers": "next",
12
12
```
13
13
14
-
Using `next` ensures that it will always use the latest v6 alpha release, but you can also use a fixed version, like `6.0.0-alpha.0`.
14
+
Using `next` ensures that it will always use the latest v6 alpha release, but you can also use a fixed version, like `6.0.0-beta.1`.
15
15
16
16
Since v6 is a major release, it contains some changes that affect the public API.
17
17
These changes were done for consistency, improve stability and make room for new features.
@@ -41,7 +41,7 @@ All other changes must be handled manually.
41
41
42
42
## Picker components
43
43
44
-
### Rename the `inputFormat` prop
44
+
### ✅ Rename the `inputFormat` prop
45
45
46
46
The `inputFormat` prop has been renamed to `format` on all the pickers components.
47
47
@@ -219,7 +219,7 @@ The `shouldDisableTime` prop signature has been changed. Either rename the prop
219
219
220
220
### ✅ Do not import adapter from `@date-io`
221
221
222
-
In v5, it was possible to import adapters either from `@date-io` or `@mui/x-date-pickers` which were the same.
222
+
In v5, it was possible to import adapters either from either `@date-io` or `@mui/x-date-pickers` which were the same.
223
223
In v6, the adapters are extended by `@mui/x-date-pickers` to support [fields components](/x/react-date-pickers/fields/).
224
224
Which means adapters can not be imported from `@date-io` anymore. They need to be imported from `@mui/x-date-pickers` or `@mui/x-date-pickers-pro`.
225
225
Otherwise, some methods will be missing.
@@ -286,7 +286,7 @@ Component names in the theme have changed as well:
286
286
287
287
### ✅ Rename `date` prop to `value`
288
288
289
-
The `date` prop has been renamed `value` on `MonthCalendar`, `YearCalendar`, `TimeClock`, and `DateCalendar` (components renamed in previous section):
289
+
The `date` prop has been renamed to `value` on `MonthCalendar`, `YearCalendar`, `TimeClock`, and `DateCalendar` (components renamed in previous section):
290
290
291
291
```diff
292
292
-<MonthPicker date={dayjs()} />
@@ -479,11 +479,11 @@ For example, the `ToolbarComponent` has been replaced by a `Toolbar` component s
479
479
/>
480
480
```
481
481
482
-
- The toolbar related translation keys have been renamed to better fit their usage:
482
+
-✅ The toolbar related translation keys have been renamed to better fit their usage:
483
483
484
484
```diff
485
-
<DatePicker
486
-
localeText={{
485
+
<LocalizationProvider
486
+
localeText={{
487
487
- datePickerDefaultToolbarTitle: 'Date Picker',
488
488
+ datePickerToolbarTitle: 'Date Picker',
489
489
@@ -495,7 +495,7 @@ For example, the `ToolbarComponent` has been replaced by a `Toolbar` component s
495
495
496
496
- dateRangePickerDefaultToolbarTitle: 'Date Range Picker',
497
497
+ dateRangePickerToolbarTitle: 'Date Range Picker',
498
-
}}
498
+
}}
499
499
/>
500
500
```
501
501
@@ -583,7 +583,7 @@ For example, the `ToolbarComponent` has been replaced by a `Toolbar` component s
583
583
584
584
### Action bar
585
585
586
-
- The `action` prop of the `actionBar` component slot can no longer receive a callback.
586
+
- The `actions` prop of the `actionBar` component slot can no longer receive a callback.
587
587
Instead, you can pass a callback at the component slot props level
588
588
589
589
```diff
@@ -735,7 +735,7 @@ For example, the `ToolbarComponent` has been replaced by a `Toolbar` component s
735
735
736
736
### ✅ Left arrow button
737
737
738
-
- The component slot `LeftArrowButton` has been renamed `PreviousIconButton`:
738
+
- The component slot `LeftArrowButton` has been renamed to `PreviousIconButton`:
739
739
740
740
```diff
741
741
<DatePicker
@@ -753,7 +753,7 @@ For example, the `ToolbarComponent` has been replaced by a `Toolbar` component s
753
753
754
754
### ✅ Right arrow button
755
755
756
-
- The component slot `RightArrowButton` has been renamed `NextIconButton`:
756
+
- The component slot `RightArrowButton` has been renamed to `NextIconButton`:
757
757
758
758
```diff
759
759
<DatePicker
@@ -783,7 +783,7 @@ For example, the `ToolbarComponent` has been replaced by a `Toolbar` component s
783
783
784
784
### ✅ Input adornment
785
785
786
-
- The `InputAdornmentProps` prop has been replaced by a`inputAdornment` component slot props:
786
+
- The `InputAdornmentProps` prop has been replaced by an`inputAdornment` component slot props:
787
787
788
788
```diff
789
789
<DatePicker
@@ -794,7 +794,7 @@ For example, the `ToolbarComponent` has been replaced by a `Toolbar` component s
794
794
795
795
### ✅ Open Picker Button
796
796
797
-
- The `OpenPickerButtonProps` prop has been replaced by a`openPickerButton` component slot props:
797
+
- The `OpenPickerButtonProps` prop has been replaced by an`openPickerButton` component slot props:
798
798
799
799
```diff
800
800
<DatePicker
@@ -853,3 +853,17 @@ Component name changes are also reflected in `themeAugmentation`:
853
853
},
854
854
});
855
855
```
856
+
857
+
## Rename `components` to `slots` (optional)
858
+
859
+
The `components` and `componentsProps` props are being renamed to `slots` and `slotProps` props respectively.
860
+
This is a slow and ongoing effort between the different MUI libraries.
861
+
To smooth the transition, pickers support both the `components` props which are deprecated, and the new `slots` props.
862
+
863
+
If you would like to use the new API and do not want to see deprecated prop usage, consider running `rename-components-to-slots` codemod handling the prop renaming.
0 commit comments