You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: site/content/docs/5.2/components/navbar.md
+47-1Lines changed: 47 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -670,7 +670,7 @@ When you do this, we recommend including additional JavaScript to move the focus
670
670
671
671
### Offcanvas
672
672
673
-
Transform your expanding and collapsing navbar into an offcanvas drawer with the offcanvas plugin. We extend both the offcanvas default styles and use our `.navbar-expand-*` classes to create a dynamic and flexible navigation sidebar.
673
+
Transform your expanding and collapsing navbar into an offcanvas drawer with the [offcanvas component]({{< docsref "/components/offcanvas" >}}). We extend both the offcanvas default styles and use our `.navbar-expand-*` classes to create a dynamic and flexible navigation sidebar.
674
674
675
675
In the example below, to create an offcanvas navbar that is always collapsed across all breakpoints, omit the `.navbar-expand-*` class entirely.
676
676
@@ -732,6 +732,52 @@ To create an offcanvas navbar that expands into a normal navbar at a specific br
732
732
</nav>
733
733
```
734
734
735
+
When using offcanvas in a dark navbar, be aware that you may need to have a dark background on the offcanvas content to avoid the text becoming illegible. In the example below, we add `.navbar-dark` and `.bg-dark` to the `.navbar`, `.text-bg-dark` to the `.offcanvas`, `.dropdown-menu-dark` to `.dropdown-menu`, and `.btn-close-white` to `.btn-close` for proper styling with a dark offcanvas.
736
+
737
+
{{< example >}}
738
+
<navclass="navbar navbar-dark bg-dark fixed-top">
739
+
<divclass="container-fluid">
740
+
<a class="navbar-brand" href="#">Offcanvas dark navbar</a>
Copy file name to clipboardExpand all lines: site/content/docs/5.2/components/offcanvas.md
+16Lines changed: 16 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -79,6 +79,22 @@ You can use a link with the `href` attribute, or a button with the `data-bs-targ
79
79
</div>
80
80
{{< /example >}}
81
81
82
+
### Dark offcanvas
83
+
84
+
Change the appearance of offcanvases with utilities to better match them to different contexts like dark navbars. Here we add `.text-bg-dark` to the `.offcanvas` and `.btn-close-white` to `.btn-close` for proper styling with a dark offcanvas. If you have dropdowns within, consider also adding `.dropdown-menu-dark` to `.dropdown-menu`.
85
+
86
+
{{< example class="bd-example-offcanvas p-0 bg-light overflow-hidden" >}}
87
+
<divclass="offcanvas offcanvas-start show text-bg-dark"tabindex="-1"id="offcanvasDark"aria-labelledby="offcanvasDarkLabel">
Scrolling the `<body>` element is disabled when an offcanvas and its backdrop are visible. Use the `data-bs-scroll` attribute to enable `<body>` scrolling.
0 commit comments