Collapsible Navigation

Description

Vertical collapsible navigation menu open or close only on menu click, it is useful for those menu have less menu item and need remain open last clicked menu option. You can experience collapsible navigation in left side menu.

CSS Classes

This table contains all classes related to the vertical collapsible navigation option.

All these options can be set via following classes:

Classes Description
.menu-collapsible To create vertical collapsible navigation, you need to add .menu-collapsible class in navigation <div> tag. Refer HTML markup line no 12.

HTML Markup

This section contains HTML Markup to create vertical collapsible navigation. It define where to add css classes to make vertical collapsible navigation.

  • Line no 12: Contain the .menu-collapsible class to set vertical navigation collapsible.
                  
                      <!DOCTYPE html>
                        <html lang="en">
                          <head></head>
                          <body data-menu="vertical-menu" class="vertical-layout vertical-menu 2-column menu-expanded">
                            <!-- fixed-top-->
                            <nav role="navigation" class="header-navbar navbar-expand-sm navbar navbar-with-menu fixed-top navbar-dark navbar-shadow navbar-border">
                                ...
                            </nav>
                            <!-- BEGIN Navigation-->
                            <div class="main-menu menu-dark menu-collapsible menu-shadow">
                                ...
                            </div>
                            <!-- END Navigation-->
                            <!-- BEGIN Content-->
                            <div class="content app-content">
                                <div class="content-wrapper">
                                    <!-- content header-->
                                    <div class="content-header row">
                                        ...
                                    </div>
                                    <!-- content header-->
                                    <!-- content body-->
                                    <div class="content-body">
                                        ...
                                    </div>
                                    <!-- content body-->
                                </div>
                            </div>
                            <!-- END Content-->
                            <!-- START FOOTER DARK-->
                            <footer class="footer footer-dark">
                                ...
                            </footer>
                            <!-- START FOOTER DARK-->
                          </body>
                        </html>
                  
                

PUG Configuration

Modern Admin use PUG as template engine to generate pages and whole template quickly using node js, for getting start with PUG usage & template generating process please refer template documentation.

PUG Variables

This table contains required PUG variables to generate vertical collapsible navigation.

Block Variable Datatype Value Description
verticalMenuConfig menuOpenType string 'menu-collapsible' verticalMenuConfig block has a menuOpenType variable, it contains navigation specific classes in that you need to set 'menu-collapsible'.
PUG Code

Use following PUG code to generate page or template having vertical collapsible navigation.

  • Line no 20-21: Set vertical collapsible navigation class to menuOpenType variable value as 'menu-collapsible' in verticalMenuConfig block.
  • Line no 27-28: content block has content section html file included include ../contents/vertical-collapsible-navigation.html, which can be customizable on page level.

If you want to use vertical collapsible navigation options on page level you need to define it on page it self. This template has one example pug file for vertical-collapsible-navigation.pug, however you can use it on template level but it will generate whole template have vertical collapsible navigation.

              
                block pageVars
                    - var pageTitle    = "Collapsible Navigation"
                    - var pageSubTitle = "Vertical collapsible navigation option"
                    - var description  = "Collapsible vertical navigation open/close menu panel on menu click only."
                    - var activeMenu   = "vertical-nav-collapsible"
                extends template
                append verticalMenuConfig
                    - var menuOpenType = "menu-collapsible"
                append breadcrumbs
                    +breadcrumbs([{url:"index.html",name:"Home"},{url:"#",name:"Navigation"}, {name:"Collapsible Navigation"}])
                //- Include page content in page block
                append content
                    include ../contents/vertical-nav-collapsible.html
                //- Vendor CSS
                //------------------------------
                //- Add Vendor specific CSS
                append vendorcss
                    link(rel='stylesheet', type='text/css', href='../../../app-assets/vendors/css/ui/prism.min.css')
                //- Page CSS
                //------------------------------
                //- Add custom page specific CSS
                append pagecss
                //- Vendor JS
                //------------------------------
                //- Add vendor specific JS
                append vendorjs
                    script(type='text/javascript' ,src='../../../app-assets/vendors/js/ui/prism.min.js')
                //- Page JS
                //------------------------------
                //- Add custom page specific JS
                append pagejs