Sidenav

Angular Bootstrap 5 Sidenav component

The side navigation component provides an easy way to navigate through your website.

Note: Read the API tab to find all available options and advanced customization

Basic example

In the basic version, the side navigation will appear over your website's content after clicking on a toggler.

Note: Use show and hide methods to toggle navigation with TypeScript.

        
            
            <mdb-sidenav-layout>
              <mdb-sidenav #sidenav="mdbSidenav">
                <ul class="sidenav-menu">
                  <mdb-sidenav-item>
                    <a class="sidenav-link" tabindex="0">
                      <i class="far fa-smile fa-fw me-3"></i><span>Link 1</span>
                    </a>
                  </mdb-sidenav-item>
                  <mdb-sidenav-item>
                    <a class="sidenav-link" tabindex="0">
                      <i class="fas fa-grin fa-fw me-3"></i><span>Category 1</span>
                    </a>
                    <ul class="sidenav-collapse" mdbCollapse>
                      <li class="sidenav-item">
                        <a class="sidenav-link" tabindex="0">Link 2</a>
                      </li>
                      <li class="sidenav-item">
                        <a class="sidenav-link" tabindex="0">Link 3</a>
                      </li>
                    </ul>
                  </mdb-sidenav-item>
                  <mdb-sidenav-item>
                    <a class="sidenav-link">
                      <i class="fas fa-grin-wink fa-fw me-3"></i><span>Category 2</span>
                    </a>
                    <ul class="sidenav-collapse" mdbCollapse>
                      <li class="sidenav-item">
                        <a class="sidenav-link" tabindex="0">Link 4</a>
                      </li>
                      <li class="sidenav-item">
                        <a class="sidenav-link" tabindex="0">Link 5</a>
                      </li>
                    </ul>
                  </mdb-sidenav-item>
                  <mdb-sidenav-item>
                    <a class="sidenav-link" tabindex="0">
                      <i class="fas fa-grin-wink fa-fw me-3"></i><span>Category 3</span>
                    </a>
                    <ul class="sidenav-collapse" mdbCollapse>
                      <li class="sidenav-item">
                        <a class="sidenav-link" tabindex="0">Link 5</a>
                      </li>
                      <li class="sidenav-item">
                        <a class="sidenav-link" tabindex="0">Link 6</a>
                      </li>
                    </ul>
                  </mdb-sidenav-item>
                  <mdb-sidenav-item>
                    <a class="sidenav-link" tabindex="0">
                      <i class="fas fa-grin-wink fa-fw me-3"></i><span>Category 4</span>
                    </a>
                    <ul class="sidenav-collapse" mdbCollapse>
                      <li class="sidenav-item">
                        <a class="sidenav-link" tabindex="0">Link 7</a>
                      </li>
                      <li class="sidenav-item">
                        <a class="sidenav-link" tabindex=">Link 8</a>
                      </li>
                    </ul>
                  </mdb-sidenav-item>
                </ul>
              </mdb-sidenav>
              <mdb-sidenav-content #sidenavContent>
                <!-- Toggler -->
                <button #sidenavToggle class="btn btn-primary" (click)="sidenav.toggle()">
                  <i class="fas fa-bars"></i>
                </button>
                <!-- Toggler -->
              </mdb-sidenav-content>
            </mdb-sidenav-layout>
          
        
    

Positioning

While using the side and push modes, you can specify the selector for your page's content - this way, the component will automatically update paddings and margins.

Select mode:

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc magna massa, ornare quis interdum a, cursus in quam. Quisque risus libero, cursus eget eros vitae, aliquam placerat velit. Vivamus luctus eros id sagittis luctus. Pellentesque felis nulla, rhoncus viverra nunc vitae, viverra aliquam ante. Ut feugiat mattis tempor.
        
            
            <mdb-sidenav-layout>
              <mdb-sidenav #sidenav="mdbSidenav" [mode]="'side'">
                ...
              </mdb-sidenav>
              <mdb-sidenav-content #sidenavContent>
                ...
              </mdb-sidenav-content>
            </mdb-sidenav-layout>
          
        
    

Colors example

Setting the color option will change the background and font color of active/hovered links and categories.

Note: This option works for MDB 5 Angular main colors - primary, secondary, warning, danger, success, info, dark and light.

Select color:

        
            
          <!-- Sidenav -->
          <mdb-sidenav-layout>
            <mdb-sidenav #sidenav="mdbSidenav" [color]="'secondary'">
              ...
            </mdb-sidenav>
            <mdb-sidenav-content #sidenavContent>
              ...
            </mdb-sidenav-content>
          </mdb-sidenav-layout>
          <!-- Sidenav -->
        
        
    

Dark example

When using the darker background with the side navigation, we recommend setting the color attribute to "light" for better contrast.

        
            
          <mdb-sidenav-layout>
            <mdb-sidenav #sidenav="mdbSidenav" [color]="'light'">
              <ul class="sidenav-menu" style="background-color: #2d2c2c; height: 100vh;">
                ...
              </ul>
            </mdb-sidenav>
            <mdb-sidenav-content #sidenavContent>
              ...
            </mdb-sidenav-content>
          </mdb-sidenav-layout>
          <!-- Sidenav -->
        
        
    

Inner scroll

Passing a selector of an inner element to the scrollContainer option will initialize MDB scrollbar only on this container (by default it's initialized on the sidenav component).

        
            
            <!-- Sidenav -->
            <mdb-sidenav-layout>
              <mdb-sidenav #sidenav="mdbSidenav" [scrollContainer]="'#container'">
                <div class="text-center">
                  <h3 class="py-4">Examples</h3>
                  <hr class="m-0" />
                </div>
                <ul id="container" mdbScrollbar class="sidenav-menu" style="height: 300px;">
                  ...
                </ul>
                <div class="text-center" style="min-height: 3rem;">
                  <hr class="mt-0 mb-2" />
                  <small>mdbootstrap.com</small>
                </div>
              </mdb-sidenav>
              <mdb-sidenav-content #sidenavContent>
                ...
              </mdb-sidenav-content>
            </mdb-sidenav-layout>
          
        
    

Menu item scroll

You can use custom styles and our Scrollbar to add inner scroll for menu items.

        
            
          <mdb-sidenav-layout>
            <mdb-sidenav
              #sidenav
              #sidenavMenuItemScroll="mdbSidenav"
              [scrollContainer]="'#container'"
            >
              <div class="text-center">
                <h3 class="py-4">Examples</h3>
                <hr class="m-0" />
              </div>
              <ul id="container" mdbScrollbar class="sidenav-menu">
                <mdb-sidenav-item>
                  <a class="sidenav-link" tabindex="0">
                    <i class="fas fa-grin fa-fw me-3"></i>
                    <span>Scrolling Category 1</span>
                  </a>
                  <ul class="sidenav-collapse" mdbScrollbar mdbCollapse style="max-height: 100px">
                    ...
                  </ul>
                </mdb-sidenav-item>
                <mdb-sidenav-item>
                  <a class="sidenav-link" tabindex="0">
                    <i class="fas fa-grin fa-fw me-3"></i>
                    <span>Scrolling Category 2</span>
                  </a>
                  <ul class="sidenav-collapse" mdbScrollbar mdbCollapse style="max-height: 100px">
                    ...
                  </ul>
                </mdb-sidenav-item>
                <mdb-sidenav-item>
                  <a class="sidenav-link" tabindex="0">
                    <i class="fas fa-grin fa-fw me-3"></i>
                    <span>Scrolling Category 3</span>
                  </a>
                  <ul class="sidenav-collapse" mdbScrollbar mdbCollapse style="max-height: 100px">
                    ...
                  </ul>
                </mdb-sidenav-item>
                <mdb-sidenav-item>
                  <a class="sidenav-link" tabindex="0">
                    <i class="fas fa-grin fa-fw me-3"></i>
                    <span>Scrolling Category 4</span>
                  </a>
                  <ul class="sidenav-collapse" mdbScrollbar mdbCollapse style="max-height: 100px">
                    ...
                  </ul>
                </mdb-sidenav-item>
                <mdb-sidenav-item>
                  <a class="sidenav-link" tabindex="0">
                    <i class="fas fa-grin fa-fw me-3"></i>
                    <span>Scrolling Category 5</span>
                  </a>
                  <ul class="sidenav-collapse" mdbScrollbar mdbCollapse style="max-height: 100px">
                    ...
                  </ul>
                </mdb-sidenav-item>
                <mdb-sidenav-item>
                  <a class="sidenav-link" tabindex="0">
                    <i class="fas fa-grin fa-fw me-3"></i>
                    <span>Scrolling Category 6</span>
                  </a>
                  <ul class="sidenav-collapse" mdbScrollbar mdbCollapse style="max-height: 100px">
                    ...
                  </ul>
                </mdb-sidenav-item>
                <mdb-sidenav-item>
                  <a class="sidenav-link" tabindex="0">
                    <i class="fas fa-grin fa-fw me-3"></i>
                    <span>Scrolling Category 7</span>
                  </a>
                  <ul class="sidenav-collapse" mdbScrollbar mdbCollapse style="max-height: 100px">
                    ...
                  </ul>
                </mdb-sidenav-item>
              </ul>
            </mdb-sidenav>
            <mdb-sidenav-content #sidenavContent>
              ...
            </mdb-sidenav-content>
          </mdb-sidenav-layout>
        
        
    

Slim example

You can hide/show elements in the slim mode by setting slim option on them - depending on value they will be either visible only in a slim or an expanded mode. Elements without this attribute will appear in both modes.

        
            
            <!-- Sidenav -->
            <mdb-sidenav-layout>
              <mdb-sidenav #sidenav="mdbSidenav" [slim]="true" [slimCollapsed]="true" [mode]="'push'">
                <ul class="sidenav-menu">
                  <mdb-sidenav-item>
                    <a class="sidenav-link" tabindex="0">
                      <i class="far fa-smile fa-fw me-3 pe-1"></i><span slim="false">Link 1</span></a
                    >
                  </mdb-sidenav-item>
                  <mdb-sidenav-item>
                    <a class="sidenav-link" tabindex="0"
                      ><i class="fas fa-grin fa-fw me-3 pe-1"></i><span slim="false">Category 1</span></a
                    >
                    <ul class="sidenav-collapse" mdbCollapse>
                      <li class="sidenav-item">
                        <a class="sidenav-link" tabindex="0">Link 2</a>
                      </li>
                      <li class="sidenav-item">
                        <a class="sidenav-link" tabindex="0">Link 3</a>
                      </li>
                    </ul>
                  </mdb-sidenav-item>
                  <mdb-sidenav-item>
                    <a class="sidenav-link" tabindex="0"
                      ><i class="fas fa-grin-wink fa-fw me-3 pe-1"></i><span slim="false">Category 2</span></a
                    >
                    <ul class="sidenav-collapse" mdbCollapse>
                      <li class="sidenav-item">
                        <a class="sidenav-link" tabindex="0">Link 4</a>
                      </li>
                      <li class="sidenav-item">
                        <a class="sidenav-link" tabindex="0">Link 5</a>
                      </li>
                    </ul>
                  </mdb-sidenav-item>
                  <mdb-sidenav-item>
                    <a class="sidenav-link" tabindex="0"
                      ><i class="fas fa-grin-wink fa-fw me-3 pe-1"></i><span slim="false">Category 3</span></a
                    >
                    <ul class="sidenav-collapse" mdbCollapse>
                      <li class="sidenav-item">
                        <a class="sidenav-link" tabindex="0">Link 5</a>
                      </li>
                      <li class="sidenav-item">
                        <a class="sidenav-link" tabindex="0">Link 6</a>
                      </li>
                    </ul>
                  </mdb-sidenav-item>
                  <mdb-sidenav-item>
                    <a class="sidenav-link" tabindex="0"
                      ><i class="fas fa-grin-wink fa-fw me-3 pe-1"></i><span slim="false">Category 4</span></a
                    >
                    <ul class="sidenav-collapse" mdbCollapse>
                      <li class="sidenav-item">
                        <a class="sidenav-link" tabindex="0">Link 7</a>
                      </li>
                      <li class="sidenav-item">
                        <a class="sidenav-link" tabindex="0">Link 8</a>
                      </li>
                    </ul>
                  </mdb-sidenav-item>
                </ul>
              </mdb-sidenav>
              <mdb-sidenav-content #sidenavContent>
                <!-- Toggler -->
                <button #sidenavToggle class="btn btn-primary" (click)="sidenav.toggle()">
                  <i class="fas fa-bars"></i>
                </button>
                <!-- Toggler -->
                <button #sidenavToggle class="btn btn-primary" (click)="sidenav.toggleSlim()">
                  toggle slim
                </button>
              </mdb-sidenav-content>
            </mdb-sidenav-layout>
          
        
    

Accordion example

Using accordion option will allow expanding only one category at once.

        
            
            <mdb-sidenav-layout>
              <mdb-sidenav #sidenav="mdbSidenav" [accordion]="true">
                ...
              </mdb-sidenav>
              <mdb-sidenav-content #sidenavContent>
                ...
              </mdb-sidenav-content>
            </mdb-sidenav-layout>
            <!-- Sidenav-->
          
        
    

Groups

You can use more than one menu inside the side navigation - in this case, accordions will be independent of one another.

        
            
          <!-- Sidenav-->
          <nav
            id="sidenav-6"
            class="sidenav"
            data-mdb-accordion="true"
            data-mdb-mode="side"
          >
            <ul class="sidenav-menu">
              <li class="sidenav-item">
                <a class="sidenav-link">
                  <i class="far fa-smile fa-fw me-3"></i><span>Link 1</span></a
                >
              </li>
              <li class="sidenav-item">
                <a class="sidenav-link"
                  ><i class="fas fa-grin fa-fw me-3"></i><span>Category 1</span></a
                >
                <ul class="sidenav-collapse">
                  <li class="sidenav-item">
                    <a class="sidenav-link">Link 2</a>
                  </li>
                  <li class="sidenav-item">
                    <a class="sidenav-link">Link 3</a>
                  </li>
                </ul>
              </li>
              <li class="sidenav-item">
                <a class="sidenav-link"
                  ><i class="fas fa-grin-wink fa-fw me-3"></i><span>Category 2</span></a
                >
                <ul class="sidenav-collapse">
                  <li class="sidenav-item">
                    <a class="sidenav-link">Link 4</a>
                  </li>
                  <li class="sidenav-item">
                    <a class="sidenav-link">Link 5</a>
                  </li>
                </ul>
              </li>
            </ul>
            <hr />
            <ul class="sidenav-menu">
              <li class="sidenav-item">
                <a class="sidenav-link">
                  <i class="far fa-smile fa-fw me-3"></i><span>Link 6</span></a
                >
              </li>
              <li class="sidenav-item">
                <a class="sidenav-link"
                  ><i class="fas fa-grin fa-fw me-3"></i><span>Category 3</span></a
                >
                <ul class="sidenav-collapse">
                  <li class="sidenav-item">
                    <a class="sidenav-link">Link 7</a>
                  </li>
                  <li class="sidenav-item">
                    <a class="sidenav-link">Link 8</a>
                  </li>
                </ul>
              </li>
              <li class="sidenav-item">
                <a class="sidenav-link"
                  ><i class="fas fa-grin-wink fa-fw me-3"></i><span>Category 4</span></a
                >
                <ul class="sidenav-collapse">
                  <li class="sidenav-item">
                    <a class="sidenav-link">Link 9</a>
                  </li>
                  <li class="sidenav-item">
                    <a class="sidenav-link">Link 10</a>
                  </li>
                </ul>
              </li>
            </ul>
          </nav>

          <!-- Sidenav-->

          <!-- Toggler -->
          <button
            data-mdb-toggle="sidenav"
            data-mdb-target="#sidenav-6"
            class="btn btn-primary"
            aria-controls="#sidenav-6"
            aria-haspopup="true"
          >
            <i class="fas fa-bars"></i>
          </button>
          <!-- Toggler -->
        
        
    

Right

Place the navigation on the other side by setting the right option to true.

        
            
            <mdb-sidenav-layout>
              <mdb-sidenav #sidenav="mdbSidenav" [right]="true">
                ...
              </mdb-sidenav>
              <mdb-sidenav-content #sidenavContent>
                ...
              </mdb-sidenav-content>
            </mdb-sidenav-layout>
            <!-- Sidenav-->
          
        
    


Full-screen examples

The following examples show various settings of the side navigation component in a full-screen mode.


1. Basic side navigation

Click the toggler to show the navigation (over mode).

        
            
            <!-- Sidenav -->
            <mdb-sidenav-layout>
              <mdb-sidenav #sidenav="mdbSidenav">
                <div class="mt-4">
                  <div id="header-content" class="ps-3">
                    <img
                      src="https://mdbcdn.b-cdn.net/img/Photos/Avatars/img%20(26).webp"
                      alt="Avatar"
                      class="rounded-circle img-fluid mb-3"
                      style="max-width: 50px"
                    />
                    <h4>Ann Smith</h4>
                    <p>ann_s@mdbootstrap.com</p>
                  </div>
                  <hr class="mb-0" />
                </div>
                <ul class="sidenav-menu">
                  <mdb-sidenav-item>
                    <a class="sidenav-link" tabindex="0" href="/">
                      <i class="fas fa-envelope fa-fw me-3"></i><span>Inbox</span></a
                    >
                  </mdb-sidenav-item>
                  <mdb-sidenav-item>
                    <a class="sidenav-link" tabindex="0">
                      <i class="fas fa-paper-plane fa-fw me-3"></i><span>Outbox</span></a
                    >
                  </mdb-sidenav-item>
                  <mdb-sidenav-item>
                    <a class="sidenav-link" tabindex="0"
                      ><i class="fas fa-address-book fa-fw me-3"></i><span>Contacts</span></a
                    >
                    <ul class="sidenav-collapse" mdbCollapse>
                      <li class="sidenav-item">
                        <a class="sidenav-link" tabindex="0">Family</a>
                      </li>
                      <li class="sidenav-item">
                        <a class="sidenav-link" tabindex="0">Friends</a>
                      </li>
                      <li class="sidenav-item">
                        <a class="sidenav-link" tabindex="0">Work</a>
                      </li>
                    </ul>
                  </mdb-sidenav-item>
                  <mdb-sidenav-item>
                    <a class="sidenav-link" tabindex="0"> <i class="fas fa-file fa-fw me-3"></i><span>Drafts</span></a>
                  </mdb-sidenav-item>
                  <mdb-sidenav-item>
                    <a class="sidenav-link" tabindex="0"> <i class="fas fa-heart fa-fw me-3"></i><span>Favourites</span></a>
                  </mdb-sidenav-item>
                  <mdb-sidenav-item>
                    <a class="sidenav-link" tabindex="0"> <i class="fas fa-star fa-fw me-3"></i><span>Starred</span></a>
                  </mdb-sidenav-item>
                  <mdb-sidenav-item>
                    <a class="sidenav-link" tabindex="0"> <i class="fas fa-trash fa-fw me-3"></i><span>Trash</span></a>
                  </mdb-sidenav-item>
                  <mdb-sidenav-item>
                    <a class="sidenav-link" tabindex="0"> <i class="fas fa-ban fa-fw me-3"></i><span>Spam</span></a>
                  </mdb-sidenav-item>
                  <mdb-sidenav-item>
                    <a class="sidenav-link" tabindex="0"><i class="fas fa-tag fa-fw me-3"></i><span>Categories</span></a>
                    <ul class="sidenav-collapse" mdbCollapse>
                      <li class="sidenav-item">
                        <a class="sidenav-link" tabindex="0">Social</a>
                      </li>
                      <li class="sidenav-item">
                        <a class="sidenav-link" tabindex="0">Notifications</a>
                      </li>
                      <li class="sidenav-item">
                        <a class="sidenav-link" tabindex="0">Recent</a>
                      </li>
                      <li class="sidenav-item">
                        <a class="sidenav-link" tabindex="0">Uploads</a>
                      </li>
                      <li class="sidenav-item">
                        <a class="sidenav-link" tabindex="0">Backups</a>
                      </li>
                      <li class="sidenav-item">
                        <a class="sidenav-link" tabindex="0">Offers</a>
                      </li>
                    </ul>
                  </mdb-sidenav-item>
                  <mdb-sidenav-item>
                    <a class="sidenav-link" tabindex="0"> <i class="fas fa-sticky-note fa-fw me-3"></i><span>Notes</span></a>
                  </mdb-sidenav-item>
                  <mdb-sidenav-item>
                    <a class="sidenav-link" tabindex="0">
                      <i class="fas fa-user-circle fa-fw me-3"></i><span>Personal</span></a
                    >
                  </mdb-sidenav-item>
                  <mdb-sidenav-item>
                    <a class="sidenav-link" tabindex="0"> <i class="fas fa-ellipsis-h fa-fw me-3"></i><span>More</span></a>
                  </mdb-sidenav-item>
                  <hr class="m-0" />
                  <mdb-sidenav-item>
                    <a class="sidenav-link" tabindex="0"> <i class="fas fa-cogs fa-fw me-3"></i><span>Settings</span></a>
                  </mdb-sidenav-item>
                  <mdb-sidenav-item>
                    <a class="sidenav-link" tabindex="0"> <i class="fas fa-user fa-fw me-3"></i><span>Profile</span></a>
                  </mdb-sidenav-item>
                  <mdb-sidenav-item>
                    <a class="sidenav-link" tabindex="0">
                      <i class="fas fa-shield-alt fa-fw me-3"></i><span>Privacy</span></a
                    >
                  </mdb-sidenav-item>
                  <mdb-sidenav-item>
                    <a class="sidenav-link" tabindex="0">
                      <i class="fas fa-user-astronaut fa-fw me-3"></i><span>Log out</span></a
                    >
                  </mdb-sidenav-item>
                </ul>
                <div class="text-center" style="height: 100px">
                  <hr class="mb-4 mt-0" />
                  <p>MDBootstrap.com</p>
                </div>
              </mdb-sidenav>
              <mdb-sidenav-content #sidenavContent>
                <div class="mdb-page-content text-center page-intro bg-light">
                  <div class="mask text-center py-5">
                    <!-- Toggler -->
                    <button class="btn btn-primary m-5" (click)="sidenav.toggle()">
                      <i class="fas fa-bars"></i>
                    </button>
                    <!-- Toggler -->
                    <div>
                      <img class="rounded" src="https://mdbcdn.b-cdn.net/img/Photos/Others/img%20(45).webp" />
                    </div>
                  </div>
                </div>
              </mdb-sidenav-content>
            </mdb-sidenav-layout>
            <!-- Sidenav -->

          
        
    
        
            
          .page-intro {
            background-color: white;
            width: 100vw;
            height: 100vh;
          }

          mask {
            width: 100%;
          }

          .mask img {
            max-width: 80%;
          }

          @media (max-width: 660px) {
            .mask img {
              width: 100%;
            }
          }
          
        
    

2. Side navigation with a mode transition

Resize the window to change the mode from side to over.

        
            
          <!-- Sidenav -->
          <mdb-sidenav-layout>
            <mdb-sidenav
              #sidenav="mdbSidenav"
              scrollContainer="#container"
              [color]="'dark'"
              [mode]="mode"
              [hidden]="hidden"
            >
              <div class="mt-4">
                <div id="header-content" class="ps-3">
                  <img
                    src="https://mdbcdn.b-cdn.net/img/Photos/Avatars/img%20(23).webp"
                    alt="Avatar"
                    class="rounded-circle img-fluid mb-3"
                    style="max-width: 50px"
                  />
                  <h4>Ann Smith</h4>
                  <p>ann_s@mdbootstrap.com</p>
                </div>
                <hr class="mb-0" />
              </div>
              <ul class="sidenav-menu" id="container" mdbScrollbar>
                <mdb-sidenav-item>
                  <a class="sidenav-link" tabindex="0" href="/">
                    <i class="fas fa-envelope fa-fw me-3"></i><span>Inbox</span></a
                  >
                </mdb-sidenav-item>
                <mdb-sidenav-item>
                  <a class="sidenav-link" tabindex="0">
                    <i class="fas fa-paper-plane fa-fw me-3"></i><span>Outbox</span></a
                  >
                </mdb-sidenav-item>
                <mdb-sidenav-item>
                  <a class="sidenav-link" tabindex="0"
                    ><i class="fas fa-address-book fa-fw me-3"></i><span>Contacts</span></a
                  >
                  <ul class="sidenav-collapse" mdbCollapse>
                    <li class="sidenav-item">
                      <a class="sidenav-link" tabindex="0">Family</a>
                    </li>
                    <li class="sidenav-item">
                      <a class="sidenav-link" tabindex="0">Friends</a>
                    </li>
                    <li class="sidenav-item">
                      <a class="sidenav-link" tabindex="0">Work</a>
                    </li>
                  </ul>
                </mdb-sidenav-item>
                <mdb-sidenav-item>
                  <a class="sidenav-link" tabindex="0"> <i class="fas fa-file fa-fw me-3"></i><span>Drafts</span></a>
                </mdb-sidenav-item>
                <mdb-sidenav-item>
                  <a class="sidenav-link" tabindex="0"> <i class="fas fa-heart fa-fw me-3"></i><span>Favourites</span></a>
                </mdb-sidenav-item>
                <mdb-sidenav-item>
                  <a class="sidenav-link" tabindex="0"> <i class="fas fa-star fa-fw me-3"></i><span>Starred</span></a>
                </mdb-sidenav-item>
                <mdb-sidenav-item>
                  <a class="sidenav-link" tabindex="0"> <i class="fas fa-trash fa-fw me-3"></i><span>Trash</span></a>
                </mdb-sidenav-item>
                <mdb-sidenav-item>
                  <a class="sidenav-link" tabindex="0"> <i class="fas fa-ban fa-fw me-3"></i><span>Spam</span></a>
                </mdb-sidenav-item>
                <mdb-sidenav-item>
                  <a class="sidenav-link" tabindex="0"><i class="fas fa-tag fa-fw me-3"></i><span>Categories</span></a>
                  <ul class="sidenav-collapse" mdbCollapse>
                    <li class="sidenav-item">
                      <a class="sidenav-link" tabindex="0">Social</a>
                    </li>
                    <li class="sidenav-item">
                      <a class="sidenav-link" tabindex="0">Notifications</a>
                    </li>
                    <li class="sidenav-item">
                      <a class="sidenav-link" tabindex="0">Recent</a>
                    </li>
                    <li class="sidenav-item">
                      <a class="sidenav-link" tabindex="0">Uploads</a>
                    </li>
                    <li class="sidenav-item">
                      <a class="sidenav-link" tabindex="0">Backups</a>
                    </li>
                    <li class="sidenav-item">
                      <a class="sidenav-link" tabindex="0">Offers</a>
                    </li>
                  </ul>
                </mdb-sidenav-item>
                <mdb-sidenav-item>
                  <a class="sidenav-link" tabindex="0"> <i class="fas fa-sticky-note fa-fw me-3"></i><span>Notes</span></a>
                </mdb-sidenav-item>
                <mdb-sidenav-item>
                  <a class="sidenav-link" tabindex="0">
                    <i class="fas fa-user-circle fa-fw me-3"></i><span>Personal</span></a
                  >
                </mdb-sidenav-item>
                <mdb-sidenav-item>
                  <a class="sidenav-link" tabindex="0"> <i class="fas fa-ellipsis-h fa-fw me-3"></i><span>More</span></a>
                </mdb-sidenav-item>
                <hr class="m-0" />
                <mdb-sidenav-item>
                  <a class="sidenav-link" tabindex="0"> <i class="fas fa-cogs fa-fw me-3"></i><span>Settings</span></a>
                </mdb-sidenav-item>
                <mdb-sidenav-item>
                  <a class="sidenav-link" tabindex="0"> <i class="fas fa-user fa-fw me-3"></i><span>Profile</span></a>
                </mdb-sidenav-item>
                <mdb-sidenav-item>
                  <a class="sidenav-link" tabindex="0">
                    <i class="fas fa-shield-alt fa-fw me-3"></i><span>Privacy</span></a
                  >
                </mdb-sidenav-item>
                <mdb-sidenav-item>
                  <a class="sidenav-link" tabindex="0">
                    <i class="fas fa-user-astronaut fa-fw me-3"></i><span>Log out</span></a
                  >
                </mdb-sidenav-item>
              </ul>
              <div class="text-center" style="height: 100px">
                <hr class="mb-4 mt-0" />
                <p>MDBootstrap.com</p>
              </div>
            </mdb-sidenav>
            <mdb-sidenav-content #sidenavContent>
              <div class="mdb-page-content text-center page-intro bg-light">
                <div class="text-center py-5">
                  <h3 class="my-5">Resize to change the mode</h3>
                  <div>
                    <img class="rounded" src="https://mdbcdn.b-cdn.net/img/Photos/Others/img%20(53).webp" />
                  </div>
                  <!-- Toggler -->
                  <button id="toggler" class="btn btn-dark mt-5" (click)="sidenav.toggle()">
                    <i class="fas fa-bars"></i>
                  </button>
                  <!-- Toggler -->
                </div>
              </div>
            </mdb-sidenav-content>
          </mdb-sidenav-layout>
          <!-- Sidenav -->

        
        
    
        
            
        import { AfterViewInit, Component, NgZone, ViewChild } from '@angular/core';
        import { MdbSidenavComponent } from 'mdb-angular-ui-kit/sidenav/sidenav.component';
        import { fromEvent } from 'rxjs';

        @Component({
          selector: 'app-mode-transition-sidenav',
          templateUrl: './mode-transition-sidenav.component.html',
          styleUrls: ['./mode-transition-sidenav.component.scss'],
        })
        export class ModeTransitionSidenavComponent implements AfterViewInit {
          @ViewChild('sidenav', { static: true }) sidenav!: MdbSidenavComponent;

          mode = window.innerWidth >= 660 ? 'side' : 'over';
          hidden = window.innerWidth >= 660 ? false : true;

          constructor(private ngZone: NgZone) {}

          ngAfterViewInit() {
            this.ngZone.runOutsideAngular(() => {
              fromEvent(window, 'resize').subscribe(() => {
                if (window.innerWidth < 660 && this.mode !== 'over') {
                  this.ngZone.run(() => {
                    this.mode = 'over';
                    this.hideSidenav();
                  });
                } else if (window.innerWidth >= 660 && this.mode !== 'side') {
                  this.ngZone.run(() => {
                    this.mode = 'side';
                    this.showSidenav();
                  });
                }
              });
            });
          }

          hideSidenav() {
            setTimeout(() => {
              this.sidenav.hide();
            }, 0);
          }

          showSidenav() {
            setTimeout(() => {
              this.sidenav.show();
            });
          }
        }
        
        
    
        
            
        .page-intro {
          background-color: white;
          width: 100vw;
          min-height: 100vh;
        }

        img {
          max-width: 80%;
        }

        .mdb-page-content {
          padding-left: 240px;
          transition: padding 0.3s linear;
        }

        #toggler {
          display: none;
        }

        @media (max-width: 660px) {
          .mdb-page-content {
            padding-left: 0px;
          }

          #toggler {
            display: unset;
          }
        }
        
        
    

3. Slim side navigation (dark)

Non-expandable slim sidenav with a dark background and custom width.

        
            
          <!-- Sidenav -->
          <mdb-sidenav-layout>
            <mdb-sidenav
              #sidenav="mdbSidenav"
              [color]="'light'"
              [mode]="'side'"
              [slimCollapsed]="true"
              [slimWidth]="90"
              [hidden]="false"
            >
              <div class="text-center py-4 bg-dark">
                <a class="ripple rounded-circle">
                  <img
                    src="https://mdbcdn.b-cdn.net/img/Photos/Avatars/img%20(29).webp"
                    alt="Avatar"
                    class="rounded-circle img-fluid"
                    style="max-width: 60px"
                  />
                </a>
                <hr />
              </div>
              <ul class="sidenav-menu bg-dark" style="height: 100vh">
                <mdb-sidenav-item>
                  <a class="sidenav-link p-0 d-flex justify-content-center">
                    <i class="far fa-heart fa-2x"></i
                  ></a>
                </mdb-sidenav-item>
                <mdb-sidenav-item>
                  <a class="sidenav-link p-0 my-3 d-flex justify-content-center">
                    <i class="far fa-envelope fa-2x"></i
                  ></a>
                </mdb-sidenav-item>
                <mdb-sidenav-item>
                  <a class="sidenav-link p-0 my-3 d-flex justify-content-center">
                    <i class="far fa-user fa-2x"></i
                  ></a>
                </mdb-sidenav-item>
                <mdb-sidenav-item>
                  <a class="sidenav-link p-0 my-3 d-flex justify-content-center">
                    <i class="fa fa-cogs fa-2x"></i
                  ></a>
                </mdb-sidenav-item>
              </ul>
            </mdb-sidenav>
            <mdb-sidenav-content #sidenavContent>
              <div class="page-intro">
                <div class="mask p-4 text-center">
                  <h1>Natalie Smith</h1>
                  <h2>Portfolio</h2>
                </div>
              </div>
            </mdb-sidenav-content>
          </mdb-sidenav-layout>
          <!-- Sidenav -->
        
        
    
        
            
        .page-intro {
          background-image: url('https://mdbcdn.b-cdn.net/img/Photos/Others/img%20(52).webp');
          background-size: cover;
          background-position-x: center;
          background-color: white;
          height: 100vh;
        }

        .mask {
          background-color: rgba(66, 66, 66, 0.4);
          width: 100vw;
          height: 100vh;
          color: rgba(255, 255, 255, 0.8);
        }

        .mask h1 {
          margin-top: 220px;
          font-size: 6rem;
        }

        .mask h2 {
          font-size: 2.8rem;
        }

        @media (max-width: 500px) {
          .mask h1 {
            font-size: 4rem;
          }

          .mask h2 {
            font-size: 2rem;
          }
        }
        
        
    

4. MDB Navigation

Navigation template based on MDB documentation with the following settings:

  • Hidden on screens smaller then 1400px
  • padding-left: 240px added via CSS to the header and main on the screens larger then 1400px to push the content out of the sidenav area
  • Sidenav toggler added to the Navbar and hidden on screen larger then 1400px
  • On screens smaller then 1400px sidenav mode changes from side to over.
        
            
        <mdb-sidenav-layout>
          <mdb-sidenav #sidenav="mdbSidenav" [mode]="mode" [position]="'fixed'" [hidden]="hidden">
            <a
              class="d-flex justify-content-center py-4"
              href="#!"
              mdbRipple
              rippleColor="primary"
              style="min-width: 240px"
            >
              <img
                id="MDB-logo"
                src="https://mdbootstrap.com/wp-content/uploads/2018/06/logo-mdb-jquery-small.png"
                alt="MDB Logo"
                draggable="false"
              />
            </a>
            <ul class="sidenav-menu">
              <mdb-sidenav-item>
                <a class="sidenav-link" tabindex="0" href="">
                  <i class="fas fa-chart-area fa-fw me-3"></i><span>Webiste traffic</span></a
                >
              </mdb-sidenav-item>
              <mdb-sidenav-item>
                <a class="sidenav-link" tabindex="0"><i class="fas fa-cogs fa-fw me-3"></i><span>Settings</span></a>
                <ul class="sidenav-collapse" mdbCollapse>
                  <li class="sidenav-item">
                    <a class="sidenav-link" tabindex="0">Profile</a>
                  </li>
                  <li class="sidenav-item">
                    <a class="sidenav-link" tabindex="0">Account</a>
                  </li>
                </ul>
              </mdb-sidenav-item>
              <mdb-sidenav-item>
                <a class="sidenav-link" tabindex="0"><i class="fas fa-cogs fa-fw me-3"></i><span>Password</span></a>
                <ul class="sidenav-collapse" mdbCollapse>
                  <li class="sidenav-item">
                    <a class="sidenav-link" tabindex="0">Request password</a>
                  </li>
                  <li class="sidenav-item">
                    <a class="sidenav-link" tabindex="0">Reset password</a>
                  </li>
                </ul>
              </mdb-sidenav-item>
            </ul>
          </mdb-sidenav>
          <mdb-sidenav-content #sidenavContent>
            <!-- Navbar -->
            <nav id="main-navbar" class="navbar navbar-expand-lg navbar-light bg-white fixed-top">
              <!-- Container wrapper -->
              <div class="container-fluid">
                <!-- Toggler -->
                <button
                  class="btn shadow-0 p-0 me-3 d-block d-xxl-none"
                  aria-controls="#sidenav-1"
                  aria-haspopup="true"
                  (click)="sidenav.toggle()"
                >
                  <i class="fas fa-bars fa-lg"></i>
                </button>

                <!-- Search form -->
                <form class="d-none d-md-flex input-group w-auto my-auto">
                  <input
                    autocomplete="off"
                    type="search"
                    class="form-control rounded"
                    placeholder='Search (ctrl + "/" to focus)'
                    style="min-width: 225px"
                  />
                  <span class="input-group-text border-0"><i class="fas fa-search"></i></span>
                </form>

                <!-- Right links -->
                <ul class="navbar-nav ms-auto d-flex flex-row">
                  <!-- Notification dropdown -->
                  <li mdbDropdown class="nav-item dropdown">
                    <a
                      mdbDropdownToggle
                      class="nav-link me-3 me-lg-0 dropdown-toggle hidden-arrow"
                      id="navbarDropdownMenuLink"
                      role="button"
                      aria-expanded="false"
                    >
                      <i class="fas fa-bell"></i>
                      <span class="badge rounded-pill badge-notification bg-danger">1</span>
                    </a>
                    <ul
                      mdbDropdownMenu
                      class="dropdown-menu dropdown-menu-end"
                      aria-labelledby="navbarDropdownMenuLink"
                    >
                      <li><a class="dropdown-item">Some news</a></li>
                      <li><a class="dropdown-item">Another news</a></li>
                      <li>
                        <a class="dropdown-item">Something else here</a>
                      </li>
                    </ul>
                  </li>

                  <!-- Icon -->
                  <li class="nav-item">
                    <a class="nav-link me-3 me-lg-0">
                      <i class="fas fa-fill-drip"></i>
                    </a>
                  </li>
                  <!-- Icon -->
                  <li class="nav-item me-3 me-lg-0">
                    <a class="nav-link">
                      <i class="fab fa-github"></i>
                    </a>
                  </li>

                  <!-- Icon dropdown -->
                  <li mdbDropdown class="nav-item dropdown">
                    <a
                      mdbDropdownToggle
                      class="nav-link me-3 me-lg-0 dropdown-toggle hidden-arrow"
                      id="navbarDropdown"
                      role="button"
                      aria-expanded="false"
                    >
                      <i class="united kingdom flag m-0"></i>
                    </a>
                    <ul
                      mdbDropdownMenu
                      class="dropdown-menu dropdown-menu-end"
                      aria-labelledby="navbarDropdown"
                    >
                      <li>
                        <a class="dropdown-item"
                          ><i class="united kingdom flag"></i>English
                          <i class="fa fa-check text-success ms-2"></i
                        ></a>
                      </li>
                      <li>
                        <hr class="dropdown-divider" />
                      </li>
                      <li>
                        <a class="dropdown-item"><i class="poland flag"></i>Polski</a>
                      </li>
                      <li>
                        <a class="dropdown-item"><i class="china flag"></i>中文</a>
                      </li>
                      <li>
                        <a class="dropdown-item"><i class="japan flag"></i>日本語</a>
                      </li>
                      <li>
                        <a class="dropdown-item"><i class="germany flag"></i>Deutsch</a>
                      </li>
                      <li>
                        <a class="dropdown-item"><i class="france flag"></i>Français</a>
                      </li>
                      <li>
                        <a class="dropdown-item"><i class="spain flag"></i>Español</a>
                      </li>
                      <li>
                        <a class="dropdown-item"><i class="russia flag"></i>Русский</a>
                      </li>
                      <li>
                        <a class="dropdown-item"><i class="portugal flag"></i>Português</a>
                      </li>
                    </ul>
                  </li>

                  <!-- Avatar -->
                  <li mdbDropdown class="nav-item dropdown">
                    <a
                      mdbDropdownToggle
                      class="nav-link dropdown-toggle hidden-arrow d-flex align-items-center"
                      id="navbarDropdownMenuLink"
                      role="button"
                      aria-expanded="false"
                    >
                      <img
                        src="https://mdbootstrap.com/img/Photos/Avatars/img (31).jpg"
                        class="rounded-circle"
                        height="22"
                        alt=""
                        loading="lazy"
                      />
                    </a>
                    <ul
                      mdbDropdownMenu
                      class="dropdown-menu dropdown-menu-end"
                      aria-labelledby="navbarDropdownMenuLink"
                    >
                      <li><a class="dropdown-item">My profile</a></li>
                      <li><a class="dropdown-item">Settings</a></li>
                      <li><a class="dropdown-item">Logout</a></li>
                    </ul>
                  </li>
                </ul>
              </div>
              <!-- Container wrapper -->
            </nav>
            <!-- Navbar -->

            <main style="margin-top: 58px" class="pb-5">
              <router-outlet></router-outlet>
            </main>
          </mdb-sidenav-content>
        </mdb-sidenav-layout>
        
        
    
        
            
        import { Component, AfterViewInit, NgZone, ViewChild } from '@angular/core';
        import { MdbSidenavComponent } from 'mdb-angular-ui-kit/sidenav';
        import { fromEvent } from 'rxjs';

        @Component({
          selector: 'app-full-mdb-sidenav',
          templateUrl: './full-mdb-sidenav.component.html',
          styleUrls: ['./full-mdb-sidenav.component.scss'],
        })
        export class FullMdbSidenavComponent implements AfterViewInit {
          @ViewChild('sidenav', { static: true }) sidenav!: MdbSidenavComponent;

          mode = window.innerWidth >= 1400 ? 'side' : 'over';
          hidden = window.innerWidth >= 1400 ? false : true;

          constructor(private ngZone: NgZone) {}

          ngAfterViewInit() {
            this.ngZone.runOutsideAngular(() => {
              fromEvent(window, 'resize').subscribe(() => {
                if (window.innerWidth < 1400 && this.mode !== 'over') {
                  this.ngZone.run(() => {
                    this.mode = 'over';
                    this.hideSidenav();
                  });
                } else if (window.innerWidth >= 1400 && this.mode !== 'side') {
                  this.ngZone.run(() => {
                    this.mode = 'side';
                    this.showSidenav();
                  });
                }
              });
            });
          }

          hideSidenav() {
            setTimeout(() => {
              this.sidenav.hide();
            }, 0);
          }

          showSidenav() {
            setTimeout(() => {
              this.sidenav.show();
            });
          }
        }
        
        
    
        
            
        @media (min-width: 1400px) {
          main,
          header,
          #main-navbar {
            padding-left: 240px;
          }
        }
        
        
    

Sidenav small and with categories

        
            
        <mdb-sidenav-layout>
          <mdb-sidenav
            #sidenav="mdbSidenav"
            position="absolute"
            [hidden]="false"
            class="sidenav-sm"
          >
            <a
              class="ripple d-flex justify-content-center py-4 mb-3"
              style="border-bottom: 2px solid #f5f5f5"
              href="#!"
              data-mdb-ripple-color="primary"
            >
              <img
                id="MDB-logo"
                src="https://mdbcdn.b-cdn.net/wp-content/uploads/2018/06/logo-mdb-jquery-small.webp"
                alt="MDB Logo"
                draggable="false"
              />
            </a>
            <ul class="sidenav-menu px-2 pb-5">
              <ng-container *ngFor="let item of items">
                <mdb-sidenav-item [ngClass]="{'pt-3 d-block': item.subheading}">
                  <span *ngIf="item.subheading" class="sidenav-subheading text-muted">{{ item.subheading }}</span>
                  <a class="sidenav-link" tabindex="0">
                    <i class="fas {{item.icon}} fa-fw me-3"></i><span>{{ item.name }}</span>
                  </a>
                </mdb-sidenav-item>
              </ng-container>
            </ul>
          </mdb-sidenav>
          <mdb-sidenav-content #sidenavContent>
            <div class="mt-5 d-flex justify-content-center">
              <!-- Toggler -->
              <button class="btn btn-primary" (click)="sidenav.toggle()">
                <i class="fas fa-bars"></i>
              </button>
              <!-- Toggler -->
            </div>
            <router-outlet></router-outlet>
          </mdb-sidenav-content>
        </mdb-sidenav-layout>
        
        
    
        
            
          import {Component} from '@angular/core';

          @Component({
            selector: 'app-root',
            templateUrl: './app.component.html',
            styleUrls: ['./app.component.scss']
          })
          export class AppComponent {
            items = [
              { name: 'Overview', icon: 'fa-tachometer-alt' },
              { name: 'Project', icon: 'fa-plus ', subheading: 'Create' },
              { name: 'Database', icon: 'fa-plus ' },
              { name: 'Project', icon: 'fa-cubes ', subheading: 'Manage' },
              { name: 'Databases', icon: 'fa-database ' },
              { name: 'Custom domains', icon: 'fa-stream ' },
              { name: 'Repositories', icon: 'fa-code-branch' },
              { name: 'Team', icon: 'fa-users' },
              { name: 'Analytics', icon: 'fa-chart-pie', subheading: 'Maintain' },
              { name: 'Backups', icon: 'fa-sync' },
              { name: 'Security', icon: 'fa-shield-alt' },
              { name: 'Admin', icon: 'fa-money-bill', subheading: 'Billing' },
              { name: 'License', icon: 'fa-file-contract' },
              { name: 'Drag & drop builder', icon: 'fa-hand-pointer', subheading: 'Tools' },
              { name: 'Online code editor', icon: 'fa-code'},
              { name: 'SFTP', icon: 'fa-copy'},
              { name: 'Jenkins', icon: 'fa-jenkins'},
              { name: 'GitLab', icon: 'fa-gitlab'},
            ]
          }
        
        
    

Sidenav - API


Import

        
            
          import { MdbSidenavModule } from 'mdb-angular-ui-kit/sidenav';
          …
          @NgModule ({
            ...
            imports: [MdbSidenavModule],
            ...
          })
        
        
    

Inputs

Name Type Default Description
accordion Boolean false Enables accordion behaviour in a navigation container
backdrop Boolean true Adds/removes a backdrop in an over mode
backdropClass String - Adds a custom class to a backdrop
closeOnEsc Boolean true Closes a side drawer on ESC key (only when toggler is visible)
color String primary Changes a color of active/hovered links and categories
expandOnHover Boolean false Expands/collapses slim mode on mouseover / mouseleave
focusTrap Boolean true Toggles focus trap feature in component template
hidden Boolean true Initializes navigation outside a viewport
mode String over Sets position mode - available options: over, side, push
scrollContainer String Selector for a scrollable container inside a side drawer
slim Boolean false Enables a slim mode
slimCollapsed Boolean false Initializes a component in a slim mode
slimWidth Number 77 A component's width in a slim mode (pixels)
position String fixed Sets CSS position - accepted values: fixed, absolute
right Boolean false Initializes sidenav on a right side
transitionDuration Number 300 Sets a length of transitions (in milliseconds)
width Number 240 A component's width (pixels)

Outputs

Name Type Description
sidenavShow EventEmitter<any> Emitted when a component has been toggled
sidenavShown EventEmitter<any> Emitted once a component is shown (after transition)
sidenavHide EventEmitter<any> Emitted when a component has been toggled
sidenavHidden EventEmitter<any> Emitted once a component is hidden (after transition)
sidenavExpand EventEmitter<any> Emitted when a slim mode has been toggled
sidenavExpanded EventEmitter<any> Emitted once a component has expanded from a slim mode (after transition)
sidenavCollapse EventEmitter<any> Emitted when a slim mode has been toggled
sidenavCollapsed EventEmitter<any> Emitted once a component has collapsed into a slim mode (after transition)
sidenavUpdate EventEmitter<any> Emitted whenever a content's offset should be updated (push/side mode).

Methods

Name Description Example
setMode Changes a position mode (options: over, side, push) sidenav.setMode('push')
hide Hides a navigation drawer sidenav.hide()
show Shows a navigation drawer sidenav.show()
toggle Manually toggles a component sidenav.toggle()
toggleSlim Manually toggles a slim state sidenav.toggleSlim()