TreeItem ContentComponent custom props
See original GitHub issue- The issue is present in the latest release.
- I have searched the issues of this repository and believe that this is not a duplicate.
Current Behavior 😯
Custom props are not possible in typescript currently.
Expected Behavior 🤔
Type should be more open: ContentProps?: React.HTMLAttributes<HTMLElement>;
Steps to Reproduce 🕹
- Use typescript
- Create custom
ContentComponent
with additional custom prop - Try to pass custom prop via
ContentProps
Context 🔦
I’m trying to use Link instead of handleSelection
callback to use native browser navigation.
Sounds this legit?
Issue Analytics
- State:
- Created 2 years ago
- Reactions:5
- Comments:6
Top Results From Across the Web
Material-UI - How to pass custom props to a custom TreeItem?
Step1 Add custom property along TreeItemContentProps on custom component create const CustomContentChildContent = React.
Read more >TreeItem API - Material UI - MUI
TreeItem API. API reference docs for the React TreeItem component. Learn about the props, CSS, and other APIs of this exported module.
Read more >Material-UI TreeView - How to get the nodeId of the TreeItem ...
Unfortunately, this props was removed in Material-UI 5.0.0 alpha-12 in favor of ContentComponent . This API requires you to write significantly more code, ......
Read more >React MUI TreeItem API - GeeksforGeeks
ContentComponent : It should be a TreeItemContent and used as a content node. ContentProps: It is used for content props. disabled: It is...
Read more >Tree View (Vue arborescente) - material-ui - GitLab - CREATE
title: Tree View React component components: TreeView, TreeItem ... You can use the ContentComponent prop and the useTreeItem hook to ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I found the way as mentioned on following document: https://github.com/mui/material-ui/blob/512896973499adbbda057e7f3685d1b23cc02de9/docs/src/components/productX/XTreeViewDemo.tsx
Step1 Add custom property along TreeItemContentProps on custom component create
Step2 Add custom property to with TreeItemProps
Step3
Add property in the component you are calling
<CustomTreeItemChild nodeId="3" label={item.name} ContentProps={{ myCustomData: 'anything-i-can-pass' }} />
Any working snippet here?