Advertisement
Google Ad Slot: content-top
Bootstrap 5 Offcanvas
The offcanvas component in Bootstrap 5 provides a way to toggle hidden content into view, similar to a modal or sidebar, without covering the entire screen. It's often used for navigation menus, sidebars, or additional content panels.
Basic Offcanvas:
To create an offcanvas component, use the following structure:
Offcanvas Title
Some placeholder text for the offcanvas content.
Position Offcanvas:
To create an offcanvas component, use the following structure.
Offcanvas Left
Offcanvas Right
Offcanvas Top
Offcanvas Bottom
Offcanvas Left
Offcanvas Right
Offcanvas Top
Offcanvas Bottom
Key Attributes
data-bs-toggle="offcanvas": Indicates that the button triggers an offcanvas component.
data-bs-target="#id": Specifies the ID of the offcanvas element to open.
aria-controls: Matches the ID of the offcanvas component for accessibility.
.offcanvas-start: Places the offcanvas to the left (default).
.offcanvas-end: Places the offcanvas to the right.
.offcanvas-top: Places the offcanvas at the top.
.offcanvas-bottom: Places the offcanvas at the bottom.