@@ -30,10 +30,10 @@ Any single `.btn` can be turned into a dropdown toggle with some markup changes.
30
30
31
31
{{< example >}}
32
32
<div class =" dropdown " >
33
- <button class =" btn btn-secondary dropdown-toggle " type =" button " id = " dropdownMenuButton1 " data-bs-toggle =" dropdown " aria-expanded =" false " >
33
+ <button class =" btn btn-secondary dropdown-toggle " type =" button " data-bs-toggle =" dropdown " aria-expanded =" false " >
34
34
Dropdown button
35
35
</button >
36
- <ul class =" dropdown-menu " aria-labelledby = " dropdownMenuButton1 " >
36
+ <ul class =" dropdown-menu " >
37
37
<li><a class="dropdown-item" href="#">Action</a></li>
38
38
<li><a class="dropdown-item" href="#">Another action</a></li>
39
39
<li><a class="dropdown-item" href="#">Something else here</a></li>
@@ -45,11 +45,11 @@ And with `<a>` elements:
45
45
46
46
{{< example >}}
47
47
<div class =" dropdown " >
48
- <a class =" btn btn-secondary dropdown-toggle " href =" # " role =" button " id = " dropdownMenuLink " data-bs-toggle =" dropdown " aria-expanded =" false " >
48
+ <a class =" btn btn-secondary dropdown-toggle " href =" # " role =" button " data-bs-toggle =" dropdown " aria-expanded =" false " >
49
49
Dropdown link
50
50
</a >
51
51
52
- <ul class =" dropdown-menu " aria-labelledby = " dropdownMenuLink " >
52
+ <ul class =" dropdown-menu " >
53
53
<li><a class="dropdown-item" href="#">Action</a></li>
54
54
<li><a class="dropdown-item" href="#">Another action</a></li>
55
55
<li><a class="dropdown-item" href="#">Something else here</a></li>
@@ -353,10 +353,10 @@ Opt into darker dropdowns to match a dark navbar or custom style by adding `.dro
353
353
354
354
{{< example >}}
355
355
<div class =" dropdown " >
356
- <button class =" btn btn-secondary dropdown-toggle " type =" button " id = " dropdownMenuButton2 " data-bs-toggle =" dropdown " aria-expanded =" false " >
356
+ <button class =" btn btn-secondary dropdown-toggle " type =" button " data-bs-toggle =" dropdown " aria-expanded =" false " >
357
357
Dropdown button
358
358
</button >
359
- <ul class =" dropdown-menu dropdown-menu-dark " aria-labelledby = " dropdownMenuButton2 " >
359
+ <ul class =" dropdown-menu dropdown-menu-dark " >
360
360
<li><a class="dropdown-item active" href="#">Action</a></li>
361
361
<li><a class="dropdown-item" href="#">Another action</a></li>
362
362
<li><a class="dropdown-item" href="#">Something else here</a></li>
@@ -378,10 +378,10 @@ And putting it to use in a navbar:
378
378
<div class="collapse navbar-collapse" id="navbarNavDarkDropdown">
379
379
<ul class="navbar-nav">
380
380
<li class="nav-item dropdown">
381
- <a class="nav-link dropdown-toggle" href="#" id="navbarDarkDropdownMenuLink" role="button" data-bs-toggle="dropdown" aria-expanded="false">
381
+ <a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
382
382
Dropdown
383
383
</a>
384
- <ul class="dropdown-menu dropdown-menu-dark" aria-labelledby="navbarDarkDropdownMenuLink" >
384
+ <ul class="dropdown-menu dropdown-menu-dark">
385
385
<li><a class="dropdown-item" href="#">Action</a></li>
386
386
<li><a class="dropdown-item" href="#">Another action</a></li>
387
387
<li><a class="dropdown-item" href="#">Something else here</a></li>
@@ -406,10 +406,10 @@ Make the dropdown menu centered below the toggle with `.dropdown-center` on the
406
406
407
407
{{< example >}}
408
408
<div class =" dropdown-center " >
409
- <button class =" btn btn-secondary dropdown-toggle " type =" button " id = " dropdownCenterBtn " data-bs-toggle =" dropdown " aria-expanded =" false " >
409
+ <button class =" btn btn-secondary dropdown-toggle " type =" button " data-bs-toggle =" dropdown " aria-expanded =" false " >
410
410
Centered dropdown
411
411
</button >
412
- <ul class =" dropdown-menu " aria-labelledby = " dropdownCenterBtn " >
412
+ <ul class =" dropdown-menu " >
413
413
<li><a class="dropdown-item" href="#">Action</a></li>
414
414
<li><a class="dropdown-item" href="#">Action two</a></li>
415
415
<li><a class="dropdown-item" href="#">Action three</a></li>
@@ -482,10 +482,10 @@ Make the dropup menu centered above the toggle with `.dropup-center` on the pare
482
482
483
483
{{< example >}}
484
484
<div class =" dropup-center dropup " >
485
- <button class =" btn btn-secondary dropdown-toggle " type =" button " id = " dropupCenterBtn " data-bs-toggle =" dropdown " aria-expanded =" false " >
485
+ <button class =" btn btn-secondary dropdown-toggle " type =" button " data-bs-toggle =" dropdown " aria-expanded =" false " >
486
486
Centered dropup
487
487
</button >
488
- <ul class =" dropdown-menu " aria-labelledby = " dropupCenterBtn " >
488
+ <ul class =" dropdown-menu " >
489
489
<li><a class="dropdown-item" href="#">Action</a></li>
490
490
<li><a class="dropdown-item" href="#">Action two</a></li>
491
491
<li><a class="dropdown-item" href="#">Action three</a></li>
@@ -617,10 +617,10 @@ You can use `<a>` or `<button>` elements as dropdown items.
617
617
618
618
{{< example >}}
619
619
<div class =" dropdown " >
620
- <button class =" btn btn-secondary dropdown-toggle " type =" button " id = " dropdownMenu2 " data-bs-toggle =" dropdown " aria-expanded =" false " >
620
+ <button class =" btn btn-secondary dropdown-toggle " type =" button " data-bs-toggle =" dropdown " aria-expanded =" false " >
621
621
Dropdown
622
622
</button >
623
- <ul class =" dropdown-menu " aria-labelledby = " dropdownMenu2 " >
623
+ <ul class =" dropdown-menu " >
624
624
<li><button class="dropdown-item" type="button">Action</button></li>
625
625
<li><button class="dropdown-item" type="button">Another action</button></li>
626
626
<li><button class="dropdown-item" type="button">Something else here</button></li>
@@ -728,10 +728,10 @@ Taking most of the options shown above, here's a small kitchen sink demo of vari
728
728
729
729
{{< example >}}
730
730
<div class =" btn-group " >
731
- <button class =" btn btn-secondary dropdown-toggle " type =" button " id = " dropdownMenuButton " data-bs-toggle =" dropdown " aria-expanded =" false " >
731
+ <button class =" btn btn-secondary dropdown-toggle " type =" button " data-bs-toggle =" dropdown " aria-expanded =" false " >
732
732
Dropdown
733
733
</button >
734
- <ul class =" dropdown-menu " aria-labelledby = " dropdownMenuButton " >
734
+ <ul class =" dropdown-menu " >
735
735
<li><a class="dropdown-item" href="#">Menu item</a></li>
736
736
<li><a class="dropdown-item" href="#">Menu item</a></li>
737
737
<li><a class="dropdown-item" href="#">Menu item</a></li>
@@ -913,21 +913,21 @@ Use `data-bs-offset` or `data-bs-reference` to change the location of the dropdo
913
913
{{< example >}}
914
914
<div class =" d-flex " >
915
915
<div class =" dropdown me-1 " >
916
- <button type="button" class="btn btn-secondary dropdown-toggle" id="dropdownMenuOffset" data-bs-toggle="dropdown" aria-expanded="false" data-bs-offset="10,20">
916
+ <button type="button" class="btn btn-secondary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false" data-bs-offset="10,20">
917
917
Offset
918
918
</button>
919
- <ul class="dropdown-menu" aria-labelledby="dropdownMenuOffset" >
919
+ <ul class="dropdown-menu">
920
920
<li><a class="dropdown-item" href="#">Action</a></li>
921
921
<li><a class="dropdown-item" href="#">Another action</a></li>
922
922
<li><a class="dropdown-item" href="#">Something else here</a></li>
923
923
</ul>
924
924
</div >
925
925
<div class =" btn-group " >
926
926
<button type="button" class="btn btn-secondary">Reference</button>
927
- <button type="button" class="btn btn-secondary dropdown-toggle dropdown-toggle-split" id="dropdownMenuReference" data-bs-toggle="dropdown" aria-expanded="false" data-bs-reference="parent">
927
+ <button type="button" class="btn btn-secondary dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown" aria-expanded="false" data-bs-reference="parent">
928
928
<span class="visually-hidden">Toggle Dropdown</span>
929
929
</button>
930
- <ul class="dropdown-menu" aria-labelledby="dropdownMenuReference" >
930
+ <ul class="dropdown-menu">
931
931
<li><a class="dropdown-item" href="#">Action</a></li>
932
932
<li><a class="dropdown-item" href="#">Another action</a></li>
933
933
<li><a class="dropdown-item" href="#">Something else here</a></li>
@@ -944,43 +944,43 @@ By default, the dropdown menu is closed when clicking inside or outside the drop
944
944
945
945
{{< example >}}
946
946
<div class =" btn-group " >
947
- <button class =" btn btn-secondary dropdown-toggle " type =" button " id = " defaultDropdown " data-bs-toggle =" dropdown " data-bs-auto-close =" true " aria-expanded =" false " >
947
+ <button class =" btn btn-secondary dropdown-toggle " type =" button " data-bs-toggle =" dropdown " data-bs-auto-close =" true " aria-expanded =" false " >
948
948
Default dropdown
949
949
</button >
950
- <ul class =" dropdown-menu " aria-labelledby = " defaultDropdown " >
950
+ <ul class =" dropdown-menu " >
951
951
<li><a class="dropdown-item" href="#">Menu item</a></li>
952
952
<li><a class="dropdown-item" href="#">Menu item</a></li>
953
953
<li><a class="dropdown-item" href="#">Menu item</a></li>
954
954
</ul >
955
955
</div >
956
956
957
957
<div class =" btn-group " >
958
- <button class =" btn btn-secondary dropdown-toggle " type =" button " id = " dropdownMenuClickableOutside " data-bs-toggle =" dropdown " data-bs-auto-close =" inside " aria-expanded =" false " >
958
+ <button class =" btn btn-secondary dropdown-toggle " type =" button " data-bs-toggle =" dropdown " data-bs-auto-close =" inside " aria-expanded =" false " >
959
959
Clickable outside
960
960
</button >
961
- <ul class =" dropdown-menu " aria-labelledby = " dropdownMenuClickableOutside " >
961
+ <ul class =" dropdown-menu " >
962
962
<li><a class="dropdown-item" href="#">Menu item</a></li>
963
963
<li><a class="dropdown-item" href="#">Menu item</a></li>
964
964
<li><a class="dropdown-item" href="#">Menu item</a></li>
965
965
</ul >
966
966
</div >
967
967
968
968
<div class =" btn-group " >
969
- <button class =" btn btn-secondary dropdown-toggle " type =" button " id = " dropdownMenuClickableInside " data-bs-toggle =" dropdown " data-bs-auto-close =" outside " aria-expanded =" false " >
969
+ <button class =" btn btn-secondary dropdown-toggle " type =" button " data-bs-toggle =" dropdown " data-bs-auto-close =" outside " aria-expanded =" false " >
970
970
Clickable inside
971
971
</button >
972
- <ul class =" dropdown-menu " aria-labelledby = " dropdownMenuClickableInside " >
972
+ <ul class =" dropdown-menu " >
973
973
<li><a class="dropdown-item" href="#">Menu item</a></li>
974
974
<li><a class="dropdown-item" href="#">Menu item</a></li>
975
975
<li><a class="dropdown-item" href="#">Menu item</a></li>
976
976
</ul >
977
977
</div >
978
978
979
979
<div class =" btn-group " >
980
- <button class =" btn btn-secondary dropdown-toggle " type =" button " id = " dropdownMenuClickable " data-bs-toggle =" dropdown " data-bs-auto-close =" false " aria-expanded =" false " >
980
+ <button class =" btn btn-secondary dropdown-toggle " type =" button " data-bs-toggle =" dropdown " data-bs-auto-close =" false " aria-expanded =" false " >
981
981
Manual close
982
982
</button >
983
- <ul class =" dropdown-menu " aria-labelledby = " dropdownMenuClickable " >
983
+ <ul class =" dropdown-menu " >
984
984
<li><a class="dropdown-item" href="#">Menu item</a></li>
985
985
<li><a class="dropdown-item" href="#">Menu item</a></li>
986
986
<li><a class="dropdown-item" href="#">Menu item</a></li>
@@ -1036,10 +1036,10 @@ Add `data-bs-toggle="dropdown"` to a link or button to toggle a dropdown.
1036
1036
1037
1037
``` html
1038
1038
<div class =" dropdown" >
1039
- <button id = " dLabel " type =" button" data-bs-toggle =" dropdown" aria-expanded =" false" >
1039
+ <button type =" button" data-bs-toggle =" dropdown" aria-expanded =" false" >
1040
1040
Dropdown trigger
1041
1041
</button >
1042
- <ul class =" dropdown-menu" aria-labelledby = " dLabel " >
1042
+ <ul class =" dropdown-menu" >
1043
1043
...
1044
1044
</ul >
1045
1045
</div >
0 commit comments