Bootstrap Offcanvas

Build sliding drawer sidebars for navigation and shopping carts.

Offcanvas is a sidebar component that can be toggled via JavaScript to appear from the left, right, top, or bottom edge of the viewport. It comes with built-in backdrop support.

Key Takeaways: Bootstrap Offcanvas

Mastering Bootstrap Offcanvas helps you write clean and reliable Bootstrap code. Follow standard conventions, test edge cases, and keep logic simple. Try running the code example below and complete the exercises to build confidence.

Bootstrap Offcanvas Code Example

Bootstrap
<button class="btn btn-primary" type="button" data-bs-toggle="offcanvas" data-bs-target="#offcanvasExample">
  Open Drawer
</button>
<div class="offcanvas offcanvas-start" tabindex="-1" id="offcanvasExample">
  <div class="offcanvas-header"><h5 class="offcanvas-title">Menu</h5></div>
  <div class="offcanvas-body">Sidebar drawer navigation links.</div>
</div>
Output
Slides out sidebar panel upon button trigger
Free sign-in required · Google login available
Finished this lesson?
Mark it complete to track your progress.

Stuck on something?

Ask the community in the CodesInTech forum.

Need a developer?

Learning on your own is great — and when you need professional help, our team builds custom software, websites and mobile apps for clients worldwide.

Explore Our Services