Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TreeView] Cannot easily remove the expand and collpase icons #12548

Open
Birddle opened this issue Mar 25, 2024 · 4 comments
Open

[TreeView] Cannot easily remove the expand and collpase icons #12548

Birddle opened this issue Mar 25, 2024 · 4 comments
Labels
component: tree view TreeView, TreeItem. This is the name of the generic UI component, not the React module! enhancement This is not a bug, nor a new feature

Comments

@Birddle
Copy link

Birddle commented Mar 25, 2024

Steps to reproduce

Link to live example: (required)
<SimpleTreeView slots={{ expandIcon:undefined, collapseIcon:undefined}}>

Steps:
1.
2.
3.

Current behavior

When setting it to undefined, it still keeps the initial collapse icon instead of having no svg at all

Expected behavior

When it is set to undefined, no svg elements are displayed

Context

No response

Your environment

npx @mui/envinfo
  Don't forget to mention which browser you used.
  Output from `npx @mui/envinfo` goes here.

Search keywords: SimpleTreeView slots v7

@Birddle Birddle added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Mar 25, 2024
@flaviendelangle
Copy link
Member

Thanks for your feedback!

When setting it to undefined, it still keeps the initial collapse icon instead of having no svg at all

Indeed...
We usually use null to remove a slot rather than undefined if I recall correctly, but this is not working either.
You can pass () => null but we will see how to improve it 👍

@flaviendelangle flaviendelangle added enhancement This is not a bug, nor a new feature component: tree view TreeView, TreeItem. This is the name of the generic UI component, not the React module! and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Mar 25, 2024
@flaviendelangle flaviendelangle changed the title SimpleTreeView slots missing initial defaults V7 [TreeView] Cannot easily remove the expand and collpase icons Mar 25, 2024
@Birddle
Copy link
Author

Birddle commented Mar 25, 2024

Thanks for your feedback!

When setting it to undefined, it still keeps the initial collapse icon instead of having no svg at all

Indeed... We usually use null to remove a slot rather than undefined if I recall correctly, but this is not working either. You can pass () => null but we will see how to improve it 👍

I do this by removing components

<TreeItem2IconContainer sx={{ width: 0}} {...getIconContainerProps()}>
            <TreeItem2Icon status={status} />
          </TreeItem2IconContainer>

and set gap to Content

<TreeItem2Content  sx={{gap:0}} ...others>

@Birddle Birddle closed this as completed Mar 25, 2024
Copy link

⚠️ This issue has been closed.
If you have a similar problem, please open a new issue and provide details about your specific problem.
If you can provide additional information related to this topic that could help future readers, please feel free to leave a comment.

How did we do @Birddle?
Your experience with our support team matters to us. If you have a moment, please share your thoughts through our brief survey.

@flaviendelangle
Copy link
Member

I'll keep the issue open to track the progress on the clean implementation 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: tree view TreeView, TreeItem. This is the name of the generic UI component, not the React module! enhancement This is not a bug, nor a new feature
Projects
None yet
Development

No branches or pull requests

2 participants