Search code examples
reactjsadmin-on-rest

How to configure the left-bar menu with sub menus in admin-on-rest?


I would love an example of how to configure the admin-on-rest left-bar menu with sub-menus.

Documentation: https://marmelab.com/admin-on-rest/Admin.html#menu


Solution

  • This is not supported out of the box in aor. However, you should be able to make your own menu and integrate material-ui sub menus in it. There's nothing special about it. Remember that your menus should use a containerElement to use React-router Link though.

    <MenuItem
       containerElement={<Link to="/profile" />}
    .../>
    

    Here is an example using the demo app on codesandbox: https://codesandbox.io/s/88ok152q08

    Note the custom Menu in menu.js.

    Also bear in mind that this menu will require a bit more work in order to adapt for mobile devices