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

How to add dropdown in sidebar #3

Open
dalpat opened this issue May 25, 2022 · 1 comment
Open

How to add dropdown in sidebar #3

dalpat opened this issue May 25, 2022 · 1 comment

Comments

@dalpat
Copy link

dalpat commented May 25, 2022

How to add dropdown menu in sidebar in menuitems js

{
    title: "Buttons",
    icon: "disc",
    href: "/buttons",
  },
  {
    title: "Forms",
    icon: "layout",
    href: "/forms",
  },
  {
    title: "Alerts",
    icon: "info",
    href: "/alerts",
  },
...

Thanks :)

@dalpat
Copy link
Author

dalpat commented May 25, 2022

I've managed to do it like this

const [openm, setOpenm] = React.useState(true);

  const handleClickm = () => {
    setOpenm(!openm);
  };

and then

<ListItemButton onClick={handleClickm}>
    <ListItemIcon>
      <FeatherIcon
        style={{
          color: "",
        }}
        icon='inbox'
        width="20"
        height="20"
      />
    </ListItemIcon>
    <ListItemText primary="Admin Stuff" />
    {openm ? <FontAwesomeIcon icon={faAngleUp} /> : <FontAwesomeIcon icon={faAngleDown} />}
</ListItemButton>

<Collapse in={openm} timeout="auto" unmountOnExit>
    <List component="div" disablePadding>

      {/* List item 1 */}
      <ListItemButton sx={{ pl: 4 }}>
        <ListItemIcon>
          <FontAwesomeIcon icon={faUsersCog} />
        </ListItemIcon>
        <ListItemText primary="Roles" />
      </ListItemButton>

      {/* List item 2 */}
      <ListItemButton sx={{ pl: 4 }}>
        <ListItemIcon>
          <FontAwesomeIcon icon={faLock} />
        </ListItemIcon>
        <ListItemText primary="Permissions" />
      </ListItemButton>

    </List>
  </Collapse>

For now its working but still no clue about how to add in menuitem js using that json syntax.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant