Skip to main content

Offcanvas

Build hidden sidebars into your project for navigation, shopping carts, and more.

Examples

Offcanvas includes support for a header with a close button and an optional body class for some initial padding. We suggest that you include offcanvas headers with dismiss actions whenever possible, or provide an explicit dismiss action.

Basic Example

Result
Loading...
Live Editor

Responsive

Responsive offcanvas classes hide content outside the viewport from a specified breakpoint and down. Above that breakpoint, the contents within will behave as usual.

Result
Loading...
Live Editor

Placement

Offcanvas supports a few different placements:

  • start places offcanvas on the left of the viewport
  • end places offcanvas on the right of the viewport
  • top places offcanvas on the top of the viewport
  • bottom places offcanvas on the bottom of the viewport
Result
Loading...
Live Editor

Backdrop

Scrolling the <body> element is disabled when an offcanvas and its backdrop are visible. Use the scroll prop to toggle <body> scrolling and the backdrop prop to toggle the backdrop.

Result
Loading...
Live Editor

Static backdrop

When backdrop is set to static, the offcanvas will not close when clicking outside of it.

Result
Loading...
Live Editor

API

Offcanvas

OffcanvasHeader

OffcanvasTitle

OffcanvasBody