@@ -12,7 +12,7 @@ productId: x-tree-view
12
12
13
13
TBD
14
14
15
- ## Start using the alpha release
15
+ ## Start using the beta release
16
16
17
17
In ` package.json ` , change the version of the tree view package to ` next ` .
18
18
@@ -41,6 +41,36 @@ The `legacy` bundle that used to support old browsers like IE11 is no longer inc
41
41
If you need support for IE11, you will need to keep using the latest version of the ` v6 ` release.
42
42
:::
43
43
44
+ ### ✅ Rename ` nodeId ` to ` itemId `
45
+
46
+ The required ` nodeId ` prop used by the ` TreeItem ` has been renamed to ` itemId ` for consistency:
47
+
48
+ ``` diff
49
+ <TreeView>
50
+ - <TreeItem label='Item 1' nodeId='one'>
51
+ + <TreeItem label='Item 1' itemId='one'>
52
+ </TreeView>
53
+ ```
54
+
55
+ The same change has been applied to the and ` ContentComponent ` prop:
56
+
57
+ ``` diff
58
+ const CustomContent = React.forwardRef((props, ref) => {
59
+ - const id = props.nodeId;
60
+ + const id = props.itemId;
61
+
62
+ // Render some UI
63
+ });
64
+
65
+ function App() {
66
+ return (
67
+ <SimpleTreeView>
68
+ <TreeItem ContentComponent={CustomContent} />
69
+ </SimpleTreeView>
70
+ )
71
+ }
72
+ ```
73
+
44
74
### ✅ Use ` SimpleTreeView ` instead of ` TreeView `
45
75
46
76
The ` TreeView ` component has been deprecated and will be removed in the next major.
@@ -56,7 +86,7 @@ You can start replacing it with the new `SimpleTreeView` component which has exa
56
86
return (
57
87
- <TreeView>
58
88
+ <SimpleTreeView>
59
- <TreeItem nodeId ="1" label="First item" />
89
+ <TreeItem itemId ="1" label="First item" />
60
90
- </TreeView>
61
91
+ </SimpleTreeView>
62
92
);
@@ -131,7 +161,7 @@ you need to use the new `expandIcon` slot on this component:
131
161
``` diff
132
162
<SimpleTreeView>
133
163
<TreeItem
134
- nodeId ="1"
164
+ itemId ="1"
135
165
label="Item 1"
136
166
- expandIcon={<MyCustomExpandIcon />}
137
167
+ slots={{ expandIcon: MyCustomExpandIcon }}
@@ -179,7 +209,7 @@ you need to use the new `collapseIcon` slot on this component:
179
209
``` diff
180
210
<SimpleTreeView>
181
211
<TreeItem
182
- nodeId ="1"
212
+ itemId ="1"
183
213
label="Item 1"
184
214
- collapseIcon={<MyCustomCollapseIcon />}
185
215
+ slots={{ collapseIcon: MyCustomCollapseIcon }}
@@ -231,7 +261,7 @@ you need to use the new `endIcon` slot on this component:
231
261
``` diff
232
262
<SimpleTreeView>
233
263
<TreeItem
234
- nodeId ="1"
264
+ itemId ="1"
235
265
label="Item 1"
236
266
- endIcon={<MyCustomEndIcon />}
237
267
+ slots={{ endIcon: MyCustomEndIcon }}
@@ -250,7 +280,7 @@ you need to use the new `icon` slot on this component:
250
280
``` diff
251
281
<SimpleTreeView>
252
282
<TreeItem
253
- nodeId ="1"
283
+ itemId ="1"
254
284
label="Item 1"
255
285
- icon={<MyCustomIcon />}
256
286
+ slots={{ icon: MyCustomIcon }}
@@ -273,7 +303,7 @@ you need to use the new `groupTransition` slot on this component:
273
303
``` diff
274
304
<SimpleTreeView>
275
305
<TreeItem
276
- nodeId ="1"
306
+ itemId ="1"
277
307
label="Item 1"
278
308
- TransitionComponent={Fade}
279
309
+ slots={{ groupTransition: Fade }}
@@ -382,8 +412,8 @@ This will help create a new headless version of the `TreeItem` component based o
382
412
+ import { TreeItem, useTreeItemState } from '@mui/x-tree-view/TreeItem';
383
413
384
414
const CustomContent = React.forwardRef((props, ref) => {
385
- - const { disabled } = useTreeItem(props.nodeId );
386
- + const { disabled } = useTreeItemState(props.nodeId );
415
+ - const { disabled } = useTreeItem(props.itemId );
416
+ + const { disabled } = useTreeItemState(props.itemId );
387
417
388
418
// Render some UI
389
419
});
0 commit comments