Side Menu
Bootstrap 5 Side menu component
Responsive Side menu with Bootstrap 5.Side Menu is a navigation component providing a clear way for navigating complex websites with lots of pages.
If you need a more advanced Side Menu and more options, see our main SideNav documentation. This component is sometimes also referred to as Side Navbar, Sidebar or Drawer navigation.
Basic example
In the basic version, the side navigation menu will appear over your website's content after clicking on a toggler.
Note: Use show
and hide
methods to toggle navigation with
JavaScript.
Note: Adding the show
class to a sidenav collapse element will expand this
category on render.
<!-- Sidenav -->
<nav id="sidenav-1" data-mdb-sidenav-init class="sidenav" data-mdb-hidden="false">
<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 show">
<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>
</nav>
<!-- Sidenav -->
<!-- Toggler -->
<button data-mdb-button-init data-mdb-toggle="sidenav" data-mdb-target="#sidenav-1" data-mdb-ripple-init class="btn btn-primary"
aria-controls="#sidenav-1" aria-haspopup="true">
<i class="fas fa-bars"></i>
</button>
<!-- Toggler -->
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. To customize this behaviour in a non-standard way, use a combination of media queries
& update.mdb.sidenav
event
Select mode:
<nav
data-mdb-sidenav-init class="sidenav"
data-mdb-mode="side"
data-mdb-content="#content"
>
...
</nav>
<nav id="content">...</nav>