Skip to content

MUI Nested Menu Example: A ClojureScript (cljs) project showcasing a customizable nested menu using Material-UI components, built with Reagent. This implementation features an intuitive structure, easy integration, and supports nested submenus.

Notifications You must be signed in to change notification settings

jramosg/jon-nested-menu

Repository files navigation

MUI Nested Menu

This project showcases a nested menu using Material-UI components in ClojureScript with Reagent Material-UI.

Example GIF

Usage

To implement the nested menu, use the following code:

[nested-menu {:button-props {:label "Open"}
              :items [{:label "Menu item 1"
                       :callback #(prn "clicked 1")}
                      {:label "Menu item 2"
                       :callback #(prn "clicked 2")
                       :items [{:label "Menu item 2.1"
                                :callback #(prn "clicked 3")
                                :items [{:label "Menu item 2.1.1"
                                         :callback #(prn "clicked 2.1.1")}]}
                               {:label "Menu item 2.2"
                                :callback #(prn "clicked 2.2")}]}]}]

Parameters

  • button-props: Map of properties for the button that triggers the menu.

    • label: (String) The label displayed on the button.
    • other button props
  • items: Vector of menu item maps.

    • label: (String) Display label for the menu item.
    • callback: (Function) Function executed on click.
    • items: (Optional) Nested vector of submenu items, which can contain the same structure.

css Styles

Add the following CSS to style the nested menu:

:root {
  --rotate-transition: 0.3s ease;
}

.nested-menu {
  pointer-events: none;
}

.nested-menu .nested-menu-item {
  pointer-events: auto;
}

.expand-group {
  transform: rotate(0deg);
}

.expand-group.MuiSvgIcon-root {
  transition: var(--rotate-transition);
}

.expand-group.expanded {
  transform: rotate(180deg);
}

License

MIT License.

Contributing

Fork the repository and submit pull requests for enhancements!

About

MUI Nested Menu Example: A ClojureScript (cljs) project showcasing a customizable nested menu using Material-UI components, built with Reagent. This implementation features an intuitive structure, easy integration, and supports nested submenus.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published