@@ -38,7 +38,7 @@ Navbars come with built-in support for a handful of sub-components. Choose from
38
38
Here's an example of all the sub-components included in a responsive light-themed navbar that automatically collapses at the ` lg ` (large) breakpoint.
39
39
40
40
{{< example >}}
41
- <nav class =" navbar navbar-expand-lg bg-light " >
41
+ <nav class =" navbar navbar-expand-lg bg-body-tertiary " >
42
42
<div class =" container-fluid " >
43
43
<a class="navbar-brand" href="#">Navbar</a>
44
44
<button class="navbar-toggler" type="button" data-coreui-toggle="collapse" data-coreui-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
@@ -64,7 +64,7 @@ Here's an example of all the sub-components included in a responsive light-theme
64
64
</ul>
65
65
</li>
66
66
<li class="nav-item">
67
- <a class="nav-link disabled">Disabled</a>
67
+ <a class="nav-link disabled" aria-disabled="true" >Disabled</a>
68
68
</li>
69
69
</ul>
70
70
<form class="d-flex" role="search">
@@ -76,7 +76,7 @@ Here's an example of all the sub-components included in a responsive light-theme
76
76
</nav >
77
77
{{< /example >}}
78
78
79
- This example uses [ background] ({{< docsref "/utilities/background" >}}) (` bg-light ` ) and [ spacing] ({{< docsref "/utilities/spacing" >}}) (` me-auto ` , ` mb-2 ` , ` mb-lg-0 ` , ` me-2 ` ) utility classes.
79
+ This example uses [ background] ({{< docsref "/utilities/background" >}}) (` bg-body-tertiary" ` ) and [ spacing] ({{< docsref "/utilities/spacing" >}}) (` me-auto ` , ` mb-2 ` , ` mb-lg-0 ` , ` me-2 ` ) utility classes.
80
80
81
81
### Brand
82
82
@@ -88,14 +88,14 @@ Add your text within an element with the `.navbar-brand` class.
88
88
89
89
{{< example >}}
90
90
<!-- As a link -->
91
- <nav class =" navbar bg-light " >
91
+ <nav class =" navbar bg-body-tertiary " >
92
92
<div class =" container-fluid " >
93
93
<a class="navbar-brand" href="#">Navbar</a>
94
94
</div >
95
95
</nav >
96
96
97
97
<!-- As a heading -->
98
- <nav class =" navbar bg-light " >
98
+ <nav class =" navbar bg-body-tertiary " >
99
99
<div class =" container-fluid " >
100
100
<span class="navbar-brand mb-0 h1">Navbar</span>
101
101
</div >
@@ -107,7 +107,7 @@ Add your text within an element with the `.navbar-brand` class.
107
107
You can replace the text within the ` .navbar-brand ` with an ` <img> ` .
108
108
109
109
{{< example >}}
110
- <nav class =" navbar bg-light " >
110
+ <nav class =" navbar bg-body-tertiary " >
111
111
<div class =" container " >
112
112
<a class="navbar-brand" href="#">
113
113
<img src="/assets/brand/coreui-signet.svg" alt="" width="22" height="24">
@@ -121,7 +121,7 @@ You can replace the text within the `.navbar-brand` with an `<img>`.
121
121
You can also make use of some additional utilities to add an image and text at the same time. Note the addition of ` .d-inline-block ` and ` .align-text-top ` on the ` <img> ` .
122
122
123
123
{{< example >}}
124
- <nav class =" navbar bg-light " >
124
+ <nav class =" navbar bg-body-tertiary " >
125
125
<div class =" container-fluid " >
126
126
<a class="navbar-brand" href="#">
127
127
<img src="/assets/brand/coreui-signet.svg" alt="" width="22" height="24" class="d-inline-block align-top">
@@ -140,7 +140,7 @@ Add the `.active` class on `.nav-link` to indicate the current page.
140
140
Please note that you should also add the ` aria-current ` attribute on the active ` .nav-link ` .
141
141
142
142
{{< example >}}
143
- <nav class =" navbar navbar-expand-lg bg-light " >
143
+ <nav class =" navbar navbar-expand-lg bg-body-tertiary " >
144
144
<div class =" container-fluid " >
145
145
<a class="navbar-brand" href="#">Navbar</a>
146
146
<button class="navbar-toggler" type="button" data-coreui-toggle="collapse" data-coreui-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
@@ -158,7 +158,7 @@ Please note that you should also add the `aria-current` attribute on the active
158
158
<a class="nav-link" href="#">Pricing</a>
159
159
</li>
160
160
<li class="nav-item">
161
- <a class="nav-link disabled">Disabled</a>
161
+ <a class="nav-link disabled" aria-disabled="true" >Disabled</a>
162
162
</li>
163
163
</ul>
164
164
</div>
@@ -169,7 +169,7 @@ Please note that you should also add the `aria-current` attribute on the active
169
169
And because we use classes for our navs, you can avoid the list-based approach entirely if you like.
170
170
171
171
{{< example >}}
172
- <nav class =" navbar navbar-expand-lg bg-light " >
172
+ <nav class =" navbar navbar-expand-lg bg-body-tertiary " >
173
173
<div class =" container-fluid " >
174
174
<a class="navbar-brand" href="#">Navbar</a>
175
175
<button class="navbar-toggler" type="button" data-coreui-toggle="collapse" data-coreui-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation">
@@ -180,7 +180,7 @@ And because we use classes for our navs, you can avoid the list-based approach e
180
180
<a class="nav-link active" aria-current="page" href="#">Home</a>
181
181
<a class="nav-link" href="#">Features</a>
182
182
<a class="nav-link" href="#">Pricing</a>
183
- <a class="nav-link disabled">Disabled</a>
183
+ <a class="nav-link disabled" aria-disabled="true" >Disabled</a>
184
184
</div>
185
185
</div>
186
186
</div >
@@ -190,7 +190,7 @@ And because we use classes for our navs, you can avoid the list-based approach e
190
190
You can also use dropdowns in your navbar. Dropdown menus require a wrapping element for positioning, so be sure to use separate and nested elements for ` .nav-item ` and ` .nav-link ` as shown below.
191
191
192
192
{{< example >}}
193
- <nav class =" navbar navbar-expand-lg bg-light " >
193
+ <nav class =" navbar navbar-expand-lg bg-body-tertiary " >
194
194
<div class =" container-fluid " >
195
195
<a class="navbar-brand" href="#">Navbar</a>
196
196
<button class="navbar-toggler" type="button" data-coreui-toggle="collapse" data-coreui-target="#navbarNavDropdown" aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation">
@@ -228,7 +228,7 @@ You can also use dropdowns in your navbar. Dropdown menus require a wrapping ele
228
228
Place various form controls and components within a navbar:
229
229
230
230
{{< example >}}
231
- <nav class =" navbar bg-light " >
231
+ <nav class =" navbar bg-body-tertiary " >
232
232
<div class =" container-fluid " >
233
233
<form class="d-flex" role="search">
234
234
<input class="form-control me-2" type="search" placeholder="Search" aria-label="Search">
@@ -241,7 +241,7 @@ Place various form controls and components within a navbar:
241
241
Immediate child elements of ` .navbar ` use flex layout and will default to ` justify-content: space-between ` . Use additional [ flex utilities] ({{< docsref "/utilities/flex" >}}) as needed to adjust this behavior.
242
242
243
243
{{< example >}}
244
- <nav class =" navbar bg-light " >
244
+ <nav class =" navbar bg-body-tertiary " >
245
245
<div class =" container-fluid " >
246
246
<a class="navbar-brand">Navbar</a>
247
247
<form class="d-flex" role="search">
@@ -255,7 +255,7 @@ Immediate child elements of `.navbar` use flex layout and will default to `justi
255
255
Input groups work, too. If your navbar is an entire form, or mostly a form, you can use the ` <form> ` element as the container and save some HTML.
256
256
257
257
{{< example >}}
258
- <nav class =" navbar bg-light " >
258
+ <nav class =" navbar bg-body-tertiary " >
259
259
<form class =" container-fluid " >
260
260
<div class="input-group">
261
261
<span class="input-group-text" id="basic-addon1">@</span>
@@ -268,7 +268,7 @@ Input groups work, too. If your navbar is an entire form, or mostly a form, you
268
268
Various buttons are supported as part of these navbar forms, too. This is also a great reminder that vertical alignment utilities can be used to align different sized elements.
269
269
270
270
{{< example >}}
271
- <nav class =" navbar bg-light " >
271
+ <nav class =" navbar bg-body-tertiary " >
272
272
<form class =" container-fluid justify-content-start " >
273
273
<button class="btn btn-outline-success me-2" type="button">Main button</button>
274
274
<button class="btn btn-sm btn-outline-secondary" type="button">Smaller button</button>
@@ -281,7 +281,7 @@ Various buttons are supported as part of these navbar forms, too. This is also a
281
281
Navbars may contain bits of text with the help of ` .navbar-text ` . This class adjusts vertical alignment and horizontal spacing for strings of text.
282
282
283
283
{{< example >}}
284
- <nav class =" navbar bg-light " >
284
+ <nav class =" navbar bg-body-tertiary " >
285
285
<div class =" container-fluid " >
286
286
<span class="navbar-text">
287
287
Navbar text with an inline element
@@ -293,7 +293,7 @@ Navbars may contain bits of text with the help of `.navbar-text`. This class adj
293
293
Mix and match with other components and utilities as needed.
294
294
295
295
{{< example >}}
296
- <nav class =" navbar navbar-expand-lg bg-light " >
296
+ <nav class =" navbar navbar-expand-lg bg-body-tertiary " >
297
297
<div class =" container-fluid " >
298
298
<a class="navbar-brand" href="#">Navbar w/ text</a>
299
299
<button class="navbar-toggler" type="button" data-coreui-toggle="collapse" data-coreui-target="#navbarText" aria-controls="navbarText" aria-expanded="false" aria-label="Toggle navigation">
@@ -436,7 +436,7 @@ Although it's not required, you can wrap a navbar in a `.container` to center it
436
436
437
437
{{< example >}}
438
438
<div class =" container " >
439
- <nav class =" navbar navbar-expand-lg bg-light " >
439
+ <nav class =" navbar navbar-expand-lg bg-body-tertiary " >
440
440
<div class="container-fluid">
441
441
<a class="navbar-brand" href="#">Navbar</a>
442
442
</div>
@@ -447,7 +447,7 @@ Although it's not required, you can wrap a navbar in a `.container` to center it
447
447
Use any of the responsive containers to change how wide the content in your navbar is presented.
448
448
449
449
{{< example >}}
450
- <nav class =" navbar navbar-expand-lg bg-light " >
450
+ <nav class =" navbar navbar-expand-lg bg-body-tertiary " >
451
451
<div class =" container-md " >
452
452
<a class="navbar-brand" href="#">Navbar</a>
453
453
</div >
@@ -461,39 +461,39 @@ Use our [position utilities]({{< docsref "/utilities/position" >}}) to place nav
461
461
Fixed navbars use ` position: fixed ` , meaning they're pulled from the normal flow of the DOM and may require custom CSS (e.g., ` padding-top ` on the ` <body> ` ) to prevent overlap with other elements.
462
462
463
463
{{< example >}}
464
- <nav class =" navbar bg-light " >
464
+ <nav class =" navbar bg-body-tertiary " >
465
465
<div class =" container-fluid " >
466
466
<a class="navbar-brand" href="#">Default</a>
467
467
</div >
468
468
</nav >
469
469
{{< /example >}}
470
470
471
471
{{< example >}}
472
- <nav class =" navbar fixed-top bg-light " >
472
+ <nav class =" navbar fixed-top bg-body-tertiary " >
473
473
<div class =" container-fluid " >
474
474
<a class="navbar-brand" href="#">Fixed top</a>
475
475
</div >
476
476
</nav >
477
477
{{< /example >}}
478
478
479
479
{{< example >}}
480
- <nav class =" navbar fixed-bottom bg-light " >
480
+ <nav class =" navbar fixed-bottom bg-body-tertiary " >
481
481
<div class =" container-fluid " >
482
482
<a class="navbar-brand" href="#">Fixed bottom</a>
483
483
</div >
484
484
</nav >
485
485
{{< /example >}}
486
486
487
487
{{< example >}}
488
- <nav class =" navbar sticky-top bg-light " >
488
+ <nav class =" navbar sticky-top bg-body-tertiary " >
489
489
<div class =" container-fluid " >
490
490
<a class="navbar-brand" href="#">Sticky top</a>
491
491
</div >
492
492
</nav >
493
493
{{< /example >}}
494
494
495
495
{{< example >}}
496
- <nav class =" navbar sticky-bottom bg-light " >
496
+ <nav class =" navbar sticky-bottom bg-body-tertiary " >
497
497
<div class =" container-fluid " >
498
498
<a class="navbar-brand" href="#">Sticky bottom</a>
499
499
</div >
@@ -509,7 +509,7 @@ Please note that this behavior comes with a potential drawback of `overflow`—w
509
509
Here's an example navbar using ` .navbar-nav-scroll ` with ` style="scroll-height: 100px;" ` , with some extra margin utilities for optimum spacing.
510
510
511
511
{{< example >}}
512
- <nav class =" navbar navbar-expand-lg bg-light " >
512
+ <nav class =" navbar navbar-expand-lg bg-body-tertiary " >
513
513
<div class =" container-fluid " >
514
514
<a class="navbar-brand" href="#">Navbar scroll</a>
515
515
<button class="navbar-toggler" type="button" data-coreui-toggle="collapse" data-coreui-target="#navbarScroll" aria-controls="navbarScroll" aria-expanded="false" aria-label="Toggle navigation">
@@ -535,7 +535,7 @@ Here's an example navbar using `.navbar-nav-scroll` with `style="scroll-height:
535
535
</ul>
536
536
</li>
537
537
<li class="nav-item">
538
- <a class="nav-link disabled">Link</a>
538
+ <a class="nav-link disabled" aria-disabled="true" >Link</a>
539
539
</li>
540
540
</ul>
541
541
<form class="d-flex" role="search">
@@ -560,7 +560,7 @@ Navbar togglers are left-aligned by default, but should they follow a sibling el
560
560
With no ` .navbar-brand ` shown at the smallest breakpoint:
561
561
562
562
{{< example >}}
563
- <nav class =" navbar navbar-expand-lg bg-light " >
563
+ <nav class =" navbar navbar-expand-lg bg-body-tertiary " >
564
564
<div class =" container-fluid " >
565
565
<button class="navbar-toggler" type="button" data-coreui-toggle="collapse" data-coreui-target="#navbarTogglerDemo01" aria-controls="navbarTogglerDemo01" aria-expanded="false" aria-label="Toggle navigation">
566
566
<span class="navbar-toggler-icon"></span>
@@ -575,7 +575,7 @@ With no `.navbar-brand` shown at the smallest breakpoint:
575
575
<a class="nav-link" href="#">Link</a>
576
576
</li>
577
577
<li class="nav-item">
578
- <a class="nav-link disabled">Disabled</a>
578
+ <a class="nav-link disabled" aria-disabled="true" >Disabled</a>
579
579
</li>
580
580
</ul>
581
581
<form class="d-flex" role="search">
@@ -590,7 +590,7 @@ With no `.navbar-brand` shown at the smallest breakpoint:
590
590
With a brand name shown on the left and toggler on the right:
591
591
592
592
{{< example >}}
593
- <nav class =" navbar navbar-expand-lg bg-light " >
593
+ <nav class =" navbar navbar-expand-lg bg-body-tertiary " >
594
594
<div class =" container-fluid " >
595
595
<a class="navbar-brand" href="#">Navbar</a>
596
596
<button class="navbar-toggler" type="button" data-coreui-toggle="collapse" data-coreui-target="#navbarTogglerDemo02" aria-controls="navbarTogglerDemo02" aria-expanded="false" aria-label="Toggle navigation">
@@ -605,7 +605,7 @@ With a brand name shown on the left and toggler on the right:
605
605
<a class="nav-link" href="#">Link</a>
606
606
</li>
607
607
<li class="nav-item">
608
- <a class="nav-link disabled">Disabled</a>
608
+ <a class="nav-link disabled" aria-disabled="true" >Disabled</a>
609
609
</li>
610
610
</ul>
611
611
<form class="d-flex" role="search">
@@ -620,7 +620,7 @@ With a brand name shown on the left and toggler on the right:
620
620
With a toggler on the left and brand name on the right:
621
621
622
622
{{< example >}}
623
- <nav class =" navbar navbar-expand-lg bg-light " >
623
+ <nav class =" navbar navbar-expand-lg bg-body-tertiary " >
624
624
<div class =" container-fluid " >
625
625
<button class="navbar-toggler" type="button" data-coreui-toggle="collapse" data-coreui-target="#navbarTogglerDemo03" aria-controls="navbarTogglerDemo03" aria-expanded="false" aria-label="Toggle navigation">
626
626
<span class="navbar-toggler-icon"></span>
@@ -635,7 +635,7 @@ With a toggler on the left and brand name on the right:
635
635
<a class="nav-link" href="#">Link</a>
636
636
</li>
637
637
<li class="nav-item">
638
- <a class="nav-link disabled">Disabled</a>
638
+ <a class="nav-link disabled" aria-disabled="true" >Disabled</a>
639
639
</li>
640
640
</ul>
641
641
<form class="d-flex" role="search">
@@ -655,7 +655,7 @@ Sometimes you want to use the collapse plugin to trigger a container element for
655
655
<div class =" collapse " id =" navbarToggleExternalContent " >
656
656
<div class =" bg-dark p-4 " >
657
657
<h5 class="text-white h4">Collapsed content</h5>
658
- <span class="text-muted ">Toggleable via the navbar brand.</span>
658
+ <span class="text-body-secondary ">Toggleable via the navbar brand.</span>
659
659
</div >
660
660
</div >
661
661
<nav class =" navbar navbar-dark bg-dark " >
@@ -676,7 +676,7 @@ Transform your expanding and collapsing navbar into an offcanvas drawer with the
676
676
In the example below, to create an offcanvas navbar that is always collapsed across all breakpoints, omit the ` .navbar-expand-* ` class entirely.
677
677
678
678
{{< example >}}
679
- <nav class =" navbar bg-light fixed-top " >
679
+ <nav class =" navbar bg-body-tertiary " fixed-top" >
680
680
<div class =" container-fluid " >
681
681
<a class="navbar-brand" href="#">Offcanvas navbar</a>
682
682
<button class="navbar-toggler" type="button" data-coreui-toggle="offcanvas" data-coreui-target="#offcanvasNavbar" aria-controls="offcanvasNavbar">
@@ -722,7 +722,7 @@ In the example below, to create an offcanvas navbar that is always collapsed acr
722
722
To create an offcanvas navbar that expands into a normal navbar at a specific breakpoint like ` lg ` , use ` .navbar-expand-lg ` .
723
723
724
724
``` html
725
- <nav class =" navbar navbar-expand-lg bg-light fixed-top" >
725
+ <nav class =" navbar navbar-expand-lg bg-body-tertiary " fixed-top " >
726
726
<a class=" navbar-brand " href=" # " >Offcanvas navbar</a>
727
727
<button class=" navbar-toggler " type=" button " data-coreui-toggle=" offcanvas " data-coreui-target=" #navbarOffcanvasLg " aria-controls=" navbarOffcanvasLg " >
728
728
<span class=" navbar-toggler-icon " ></span>
@@ -739,13 +739,13 @@ When using offcanvas in a dark navbar, be aware that you may need to have a dark
739
739
<nav class=" navbar navbar-dark bg-dark fixed-top " >
740
740
<div class=" container-fluid " >
741
741
<a class=" navbar-brand " href=" # " >Offcanvas dark navbar</a>
742
- <button class="navbar-toggler" type="button" data-cui -toggle="offcanvas" data-cui -target="#offcanvasDarkNavbar" aria-controls="offcanvasDarkNavbar">
742
+ <button class=" navbar-toggler " type=" button " data-coreui -toggle=" offcanvas " data-coreui -target=" #offcanvasDarkNavbar " aria-controls=" offcanvasDarkNavbar " >
743
743
<span class=" navbar-toggler-icon " ></span>
744
744
</button>
745
745
<div class=" offcanvas offcanvas-end text-bg-dark " tabindex=" -1 " id=" offcanvasDarkNavbar " aria-labelledby=" offcanvasDarkNavbarLabel " >
746
746
<div class=" offcanvas-header " >
747
747
<h5 class=" offcanvas-title " id=" offcanvasDarkNavbarLabel " >Dark offcanvas</h5>
748
- <button type="button" class="btn-close btn-close-white" data-cui -dismiss="offcanvas" aria-label="Close"></button>
748
+ <button type=" button " class=" btn-close btn-close-white " data-coreui -dismiss=" offcanvas " aria-label=" Close " ></button>
749
749
</div>
750
750
<div class=" offcanvas-body " >
751
751
<ul class=" navbar-nav justify-content-end flex-grow-1 pe-3 " >
@@ -756,7 +756,7 @@ When using offcanvas in a dark navbar, be aware that you may need to have a dark
756
756
<a class=" nav-link " href=" # " >Link</a>
757
757
</li>
758
758
<li class=" nav-item dropdown " >
759
- <a class="nav-link dropdown-toggle" href="#" role="button" data-cui -toggle="dropdown" aria-expanded="false">
759
+ <a class=" nav-link dropdown-toggle " href=" # " role=" button " data-coreui -toggle=" dropdown " aria-expanded=" false " >
760
760
Dropdown
761
761
</a>
762
762
<ul class=" dropdown-menu dropdown-menu-dark " >
@@ -781,7 +781,7 @@ When using offcanvas in a dark navbar, be aware that you may need to have a dark
781
781
782
782
## Customizing
783
783
784
- ### CSS Variables
784
+ ### CSS variables
785
785
786
786
Navbars use local CSS variables on `.navbar` for enhanced real-time customization. Values for the CSS variables are set via Sass, so Sass customization is still supported, too.
787
787
@@ -793,13 +793,17 @@ Some additional CSS variables are also present on `.navbar-nav`:
793
793
794
794
### SASS variables
795
795
796
+ Variables for all navbars:
797
+
796
798
{{< scss-docs name=" navbar-variables " file=" scss /_variables.scss " >}}
797
799
798
- {{< scss-docs name="navbar-theme-variables" file="scss/_ variables.scss" >}}
800
+ Variables for the [dark navbar](#color-schemes):
801
+
802
+ {{< scss-docs name=" navbar-dark-variables " file=" scss /_variables.scss " >}}
799
803
800
804
### SASS loop
801
805
802
806
[Responsive navbar expand/collapse classes](#responsive-behaviors) (e.g., `.navbar-expand-lg`) are combined with the `$breakpoints` map and generated through a loop in `scss/_navbar.scss`.
803
807
804
808
{{< scss-docs name=" navbar-expand-loop " file=" scss /_navbar.scss " >}}
805
-
809
+ s
0 commit comments