flowbite-mcp 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +324 -0
  3. package/build/index.js +975 -0
  4. package/build/server-runner.js +228 -0
  5. package/data/components/accordion.md +860 -0
  6. package/data/components/alerts.md +739 -0
  7. package/data/components/avatar.md +178 -0
  8. package/data/components/badge.md +420 -0
  9. package/data/components/banner.md +145 -0
  10. package/data/components/bottom-navigation.md +513 -0
  11. package/data/components/breadcrumb.md +273 -0
  12. package/data/components/button-group.md +410 -0
  13. package/data/components/buttons.md +405 -0
  14. package/data/components/card.md +711 -0
  15. package/data/components/carousel.md +858 -0
  16. package/data/components/chat-bubble.md +1063 -0
  17. package/data/components/clipboard.md +1029 -0
  18. package/data/components/datepicker.md +673 -0
  19. package/data/components/device-mockups.md +152 -0
  20. package/data/components/drawer.md +1353 -0
  21. package/data/components/dropdowns.md +1925 -0
  22. package/data/components/footer.md +299 -0
  23. package/data/components/forms.md +371 -0
  24. package/data/components/gallery.md +322 -0
  25. package/data/components/indicators.md +262 -0
  26. package/data/components/jumbotron.md +213 -0
  27. package/data/components/kbd.md +217 -0
  28. package/data/components/list-group.md +365 -0
  29. package/data/components/mega-menu.md +558 -0
  30. package/data/components/modal.md +1309 -0
  31. package/data/components/navbar.md +1053 -0
  32. package/data/components/pagination.md +472 -0
  33. package/data/components/popover.md +826 -0
  34. package/data/components/progress.md +95 -0
  35. package/data/components/qr-code.md +280 -0
  36. package/data/components/rating.md +323 -0
  37. package/data/components/sidebar.md +1067 -0
  38. package/data/components/skeleton.md +221 -0
  39. package/data/components/speed-dial.md +1270 -0
  40. package/data/components/spinner.md +222 -0
  41. package/data/components/stepper.md +271 -0
  42. package/data/components/tables.md +3127 -0
  43. package/data/components/tabs.md +808 -0
  44. package/data/components/timeline.md +304 -0
  45. package/data/components/toast.md +341 -0
  46. package/data/components/tooltips.md +524 -0
  47. package/data/components/typography.md +269 -0
  48. package/data/components/video.md +95 -0
  49. package/data/forms/checkbox.md +375 -0
  50. package/data/forms/file-input.md +98 -0
  51. package/data/forms/floating-label.md +185 -0
  52. package/data/forms/input-field.md +222 -0
  53. package/data/forms/number-input.md +1099 -0
  54. package/data/forms/phone-input.md +577 -0
  55. package/data/forms/radio.md +315 -0
  56. package/data/forms/range.md +83 -0
  57. package/data/forms/search-input.md +280 -0
  58. package/data/forms/select.md +259 -0
  59. package/data/forms/textarea.md +155 -0
  60. package/data/forms/timepicker.md +732 -0
  61. package/data/forms/toggle.md +176 -0
  62. package/data/plugins/charts.md +2683 -0
  63. package/data/plugins/datatables.md +1922 -0
  64. package/data/plugins/datepicker.md +5 -0
  65. package/data/plugins/wysiwyg.md +2377 -0
  66. package/data/quickstart.md +169 -0
  67. package/data/theme.md +231 -0
  68. package/data/toc.md +79 -0
  69. package/data/typography/blockquote.md +182 -0
  70. package/data/typography/headings.md +174 -0
  71. package/data/typography/hr.md +74 -0
  72. package/data/typography/images.md +168 -0
  73. package/data/typography/links.md +118 -0
  74. package/data/typography/lists.md +387 -0
  75. package/data/typography/paragraphs.md +186 -0
  76. package/data/typography/text.md +249 -0
  77. package/package.json +71 -0
@@ -0,0 +1,1925 @@
1
+ ---
2
+ layout: docs
3
+ title: Tailwind CSS Dropdown - Flowbite
4
+ description: Get started with the dropdown component to show a list of menu items when clicking on the trigger element based on multiple layouts, styles, and placements
5
+ group: components
6
+ toc: true
7
+ requires_js: true
8
+
9
+ previous: Drawer
10
+ previousLink: components/drawer/
11
+ next: Footer
12
+ nextLink: components/footer/
13
+ ---
14
+
15
+ The dropdown component can be used to show a list of menu items when clicking on an element such as a button and hiding it when focusing outside of the triggering element.
16
+
17
+ Make sure to include <a href="{{< ref "getting-started/quickstart" >}}">Flowbite's JavaScript file</a> inside your project to enable dropdowns.
18
+
19
+ ## Dropdown example
20
+
21
+ If you want to show a dropdown menu when clicking on an element make sure that you add the data attribute `data-dropdown-toggle="dropdownId"` to the element (ie. a button) that will trigger the dropdown menu.
22
+
23
+ The `dropdownId` is the id of the dropdown menu element.
24
+
25
+ {{< example class="flex justify-center" github="components/dropdowns.md" show_dark=true iframeHeight="300" >}}
26
+ <button id="dropdownDefaultButton" data-dropdown-toggle="dropdown" class="inline-flex items-center justify-center text-white bg-brand box-border border border-transparent hover:bg-brand-strong focus:ring-4 focus:ring-brand-medium shadow-xs font-medium leading-5 rounded-base text-sm px-4 py-2.5 focus:outline-none" type="button">
27
+ Dropdown button
28
+ <svg class="w-4 h-4 ms-1.5 -me-0.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m19 9-7 7-7-7"/></svg>
29
+ </button>
30
+
31
+ <!-- Dropdown menu -->
32
+ <div id="dropdown" class="z-10 hidden bg-neutral-primary-medium border border-default-medium rounded-base shadow-lg w-44">
33
+ <ul class="p-2 text-sm text-body font-medium" aria-labelledby="dropdownDefaultButton">
34
+ <li>
35
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Dashboard</a>
36
+ </li>
37
+ <li>
38
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Settings</a>
39
+ </li>
40
+ <li>
41
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Earnings</a>
42
+ </li>
43
+ <li>
44
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Sign out</a>
45
+ </li>
46
+ </ul>
47
+ </div>
48
+ {{< /example >}}
49
+
50
+ ## Dropdown hover
51
+
52
+ Use the `data-dropdown-trigger="{hover|click}"` data attribute options to set whether the dropdown should be shown when hovering or clicking on the trigger element (ie. button).
53
+
54
+ There's a 300ms default delay when showing or hiding the dropdown due to UI/UX reasons and how it may affect the interaction with other components on the page. Generally, we recommend using the `click` method.
55
+
56
+ {{< example class="flex justify-center" github="components/dropdowns.md" show_dark=true iframeHeight="300" >}}
57
+ <button id="dropdownHoverButton" data-dropdown-toggle="dropdownHover" data-dropdown-trigger="hover" class="inline-flex items-center justify-center text-white bg-brand box-border border border-transparent hover:bg-brand-strong focus:ring-4 focus:ring-brand-medium shadow-xs font-medium leading-5 rounded-base text-sm px-4 py-2.5 focus:outline-none" type="button">
58
+ Dropdown button
59
+ <svg class="w-4 h-4 ms-1.5 -me-0.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m19 9-7 7-7-7"/></svg>
60
+ </button>
61
+
62
+ <!-- Dropdown menu -->
63
+ <div id="dropdownHover" class="z-10 hidden bg-neutral-primary-medium border border-default-medium rounded-base shadow-lg w-44">
64
+ <ul class="p-2 text-sm text-body font-medium" aria-labelledby="dropdownHoverButton">
65
+ <li>
66
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Dashboard</a>
67
+ </li>
68
+ <li>
69
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Settings</a>
70
+ </li>
71
+ <li>
72
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Earnings</a>
73
+ </li>
74
+ <li>
75
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Sign out</a>
76
+ </li>
77
+ </ul>
78
+ </div>
79
+ {{< /example >}}
80
+
81
+ ### Delay duration
82
+
83
+ You can use the `data-dropdown-delay={milliseconds}` data attribute to set they delay on when to show or hide the dropdown menu when using hover. You may want to use this depending on how the users interact with your interface. In this example we add 500 milliseconds instead of the default 300.
84
+
85
+ {{< example class="flex justify-center" github="components/dropdowns.md" show_dark=true iframeHeight="300" >}}
86
+ <button id="dropdownDelayButton" data-dropdown-toggle="dropdownDelay" data-dropdown-delay="500" data-dropdown-trigger="hover" class="inline-flex items-center justify-center text-white bg-brand box-border border border-transparent hover:bg-brand-strong focus:ring-4 focus:ring-brand-medium shadow-xs font-medium leading-5 rounded-base text-sm px-4 py-2.5 focus:outline-none" type="button">
87
+ Dropdown button
88
+ <svg class="w-4 h-4 ms-1.5 -me-0.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m19 9-7 7-7-7"/></svg>
89
+ </button>
90
+
91
+ <!-- Dropdown menu -->
92
+ <div id="dropdownDelay" class="z-10 hidden bg-neutral-primary-medium border border-default-medium rounded-base shadow-lg w-44">
93
+ <ul class="p-2 text-sm text-body font-medium" aria-labelledby="dropdownDelayButton">
94
+ <li>
95
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Dashboard</a>
96
+ </li>
97
+ <li>
98
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Settings</a>
99
+ </li>
100
+ <li>
101
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Earnings</a>
102
+ </li>
103
+ <li>
104
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Sign out</a>
105
+ </li>
106
+ </ul>
107
+ </div>
108
+ {{< /example >}}
109
+
110
+ ## Dropdown divider
111
+
112
+ You can use the `divide-y divide-gray-100` classes to add separate elements inside the dropdown menu.
113
+
114
+ {{< example class="flex justify-center" github="components/dropdowns.md" show_dark=true iframeHeight="320" >}}
115
+ <button id="dropdownDividerButton" data-dropdown-toggle="dropdownDivider" class="inline-flex items-center justify-center text-white bg-brand box-border border border-transparent hover:bg-brand-strong focus:ring-4 focus:ring-brand-medium shadow-xs font-medium leading-5 rounded-base text-sm px-4 py-2.5 focus:outline-none" type="button">
116
+ Dropdown button
117
+ <svg class="w-4 h-4 ms-1.5 -me-0.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m19 9-7 7-7-7"/></svg>
118
+ </button>
119
+
120
+ <!-- Dropdown menu -->
121
+ <div id="dropdownDivider" class="z-10 hidden bg-neutral-primary-medium border border-default-medium rounded-base divide-y divide-default-medium shadow-lg w-44">
122
+ <ul class="p-2 text-sm text-body font-medium" aria-labelledby="dropdownDividerButton">
123
+ <li>
124
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Dashboard</a>
125
+ </li>
126
+ <li>
127
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Settings</a>
128
+ </li>
129
+ <li>
130
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Earnings</a>
131
+ </li>
132
+ </ul>
133
+ <div class="p-2 text-sm text-body font-medium">
134
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Separated link</a>
135
+ </div>
136
+ </div>
137
+ {{< /example >}}
138
+
139
+ ## Dropdown header
140
+
141
+ Use this example to show extra information outside of the list of menu items inside the dropdown.
142
+
143
+ {{< example class="flex justify-center " github="components/dropdowns.md" show_dark=true iframeHeight="520" >}}
144
+ <button id="dropdownInformationButton" data-dropdown-toggle="dropdownInformation" class="inline-flex items-center justify-center text-white bg-brand box-border border border-transparent hover:bg-brand-strong focus:ring-4 focus:ring-brand-medium shadow-xs font-medium leading-5 rounded-base text-sm px-4 py-2.5 focus:outline-none" type="button">
145
+ Dropdown button
146
+ <svg class="w-4 h-4 ms-1.5 -me-0.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m19 9-7 7-7-7"/></svg>
147
+ </button>
148
+ <!-- Dropdown menu -->
149
+ <div id="dropdownInformation" class="z-10 hidden bg-neutral-primary-medium border border-default-medium rounded-base shadow-lg w-72">
150
+ <div class="p-2">
151
+ <div class="flex items-center px-2.5 p-2 space-x-1.5 text-sm bg-neutral-secondary-strong rounded">
152
+ <img class="w-8 h-8 rounded-full" src="/docs/images/people/profile-picture-5.jpg" alt="Rounded avatar">
153
+ <div class="text-sm">
154
+ <div class="font-medium text-heading">Bonnie Green</div>
155
+ <div class="truncate text-body">name@flowbite.com</div>
156
+ </div>
157
+ <span class="bg-brand-softer border border-brand-subtle text-fg-brand-strong text-xs font-medium px-1.5 py-0.5 rounded ms-auto">PRO</span>
158
+ </div>
159
+ </div>
160
+ <ul class="px-2 pb-2 text-sm text-body font-medium" aria-labelledby="dropdownInformationButton">
161
+ <li>
162
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">
163
+ <svg class="w-4 h-4 me-1.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-width="2" d="M7 17v1a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1v-1a3 3 0 0 0-3-3h-4a3 3 0 0 0-3 3Zm8-9a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"/></svg>
164
+ Account
165
+ </a>
166
+ </li>
167
+ <li>
168
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">
169
+ <svg class="w-4 h-4 me-1.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M20 6H10m0 0a2 2 0 1 0-4 0m4 0a2 2 0 1 1-4 0m0 0H4m16 6h-2m0 0a2 2 0 1 0-4 0m4 0a2 2 0 1 1-4 0m0 0H4m16 6H10m0 0a2 2 0 1 0-4 0m4 0a2 2 0 1 1-4 0m0 0H4"/></svg>
170
+ Settings
171
+ </a>
172
+ </li>
173
+ <li>
174
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">
175
+ <svg class="w-4 h-4 me-1.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 14v3m-3-6V7a3 3 0 1 1 6 0v4m-8 0h10a1 1 0 0 1 1 1v7a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1v-7a1 1 0 0 1 1-1Z"/></svg>
176
+ Privacy
177
+ </a>
178
+ </li>
179
+ <li>
180
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">
181
+ <svg class="w-4 h-4 me-1.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 5.365V3m0 2.365a5.338 5.338 0 0 1 5.133 5.368v1.8c0 2.386 1.867 2.982 1.867 4.175 0 .593 0 1.292-.538 1.292H5.538C5 18 5 17.301 5 16.708c0-1.193 1.867-1.789 1.867-4.175v-1.8A5.338 5.338 0 0 1 12 5.365ZM8.733 18c.094.852.306 1.54.944 2.112a3.48 3.48 0 0 0 4.646 0c.638-.572 1.236-1.26 1.33-2.112h-6.92Z"/></svg>
182
+ Notifications
183
+ </a>
184
+ </li>
185
+ <li>
186
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">
187
+ <svg class="w-4 h-4 me-1.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9.529 9.988a2.502 2.502 0 1 1 5 .191A2.441 2.441 0 0 1 12 12.582V14m-.01 3.008H12M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"/></svg>
188
+ Help center
189
+ </a>
190
+ </li>
191
+ <li class="flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded mb-1.5">
192
+ <a href="#" class="inline-flex items-center">
193
+ <svg class="w-4 h-4 me-1.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 21a9 9 0 0 1-.5-17.986V3c-.354.966-.5 1.911-.5 3a9 9 0 0 0 9 9c.239 0 .254.018.488 0A9.004 9.004 0 0 1 12 21Z"/></svg>
194
+ Dark mode
195
+ </a>
196
+ <label class="inline-flex items-center cursor-pointer ms-auto">
197
+ <input type="checkbox" value="" class="sr-only peer">
198
+ <div class="relative w-9 h-5 bg-neutral-quaternary peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-brand-soft dark:peer-focus:ring-brand-soft rounded-full peer peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-buffer after:content-[''] after:absolute after:top-[2px] after:start-[2px] after:bg-white after:rounded-full after:h-4 after:w-4 after:transition-all peer-checked:bg-brand"></div>
199
+ <span class="ms-3 text-sm font-medium text-heading sr-only">Toggle me</span>
200
+ </label>
201
+ </li>
202
+ <li class="border-t border-default-medium pt-1.5">
203
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">
204
+ <svg class="w-4 h-4 me-1.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m10.051 8.102-3.778.322-1.994 1.994a.94.94 0 0 0 .533 1.6l2.698.316m8.39 1.617-.322 3.78-1.994 1.994a.94.94 0 0 1-1.595-.533l-.4-2.652m8.166-11.174a1.366 1.366 0 0 0-1.12-1.12c-1.616-.279-4.906-.623-6.38.853-1.671 1.672-5.211 8.015-6.31 10.023a.932.932 0 0 0 .162 1.111l.828.835.833.832a.932.932 0 0 0 1.111.163c2.008-1.102 8.35-4.642 10.021-6.312 1.475-1.478 1.133-4.77.855-6.385Zm-2.961 3.722a1.88 1.88 0 1 1-3.76 0 1.88 1.88 0 0 1 3.76 0Z"/></svg>
205
+ Upgrade to PRO
206
+ </a>
207
+ </li>
208
+ <li>
209
+ <a href="#" class="inline-flex items-center w-full p-2 text-fg-danger hover:bg-neutral-tertiary-medium rounded">
210
+ <svg class="w-4 h-4 me-1.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20 12H8m12 0-4 4m4-4-4-4M9 4H7a3 3 0 0 0-3 3v10a3 3 0 0 0 3 3h2"/></svg>
211
+ Sign out
212
+ </a>
213
+ </li>
214
+ </ul>
215
+ </div>
216
+ {{< /example >}}
217
+
218
+ ## Multi-level dropdown
219
+
220
+ Use this example to enable multi-level dropdown menus by adding stacked elements inside of each other.
221
+
222
+ {{< example class="flex justify-center" github="components/dropdowns.md" show_dark=true iframeHeight="350" >}}
223
+ <button id="multiLevelDropdownButton" data-dropdown-toggle="multi-dropdown" class="inline-flex items-center justify-center text-white bg-brand box-border border border-transparent hover:bg-brand-strong focus:ring-4 focus:ring-brand-medium shadow-xs font-medium leading-5 rounded-base text-sm px-4 py-2.5 focus:outline-none" type="button">
224
+ Dropdown button
225
+ <svg class="w-4 h-4 ms-1.5 -me-0.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m19 9-7 7-7-7"/></svg>
226
+ </button>
227
+
228
+ <!-- Dropdown menu -->
229
+ <div id="multi-dropdown" class="z-10 hidden bg-neutral-primary-medium border border-default-medium rounded-base shadow-lg w-44">
230
+ <ul class="p-2 text-sm text-body font-medium" aria-labelledby="multiLevelDropdownButton">
231
+ <li>
232
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Dashboard</a>
233
+ </li>
234
+ <li>
235
+ <button id="doubleDropdownButton" data-dropdown-toggle="doubleDropdown" data-dropdown-placement="right-start" type="button" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">
236
+ Dropdown
237
+ <svg class="h-4 w-4 ms-auto rtl:rotate-180" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m9 5 7 7-7 7"/></svg>
238
+ </button>
239
+ <div id="doubleDropdown" class="z-10 hidden bg-neutral-primary-medium border border-default-medium rounded-base shadow-lg w-44">
240
+ <ul class="p-2 text-sm text-body font-medium" aria-labelledby="doubleDropdownButton">
241
+ <li>
242
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Overview</a>
243
+ </li>
244
+ <li>
245
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">My downloads</a>
246
+ </li>
247
+ <li>
248
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Billing</a>
249
+ </li>
250
+ <li>
251
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Rewards</a>
252
+ </li>
253
+ </ul>
254
+ </div>
255
+ </li>
256
+ <li>
257
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Earnings</a>
258
+ </li>
259
+ <li>
260
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Sign out</a>
261
+ </li>
262
+ </ul>
263
+ </div>
264
+ {{< /example >}}
265
+
266
+ ## Dropdown with checkbox
267
+
268
+ Add multiple checkbox elements inside your dropdown menu to enable more advanced input interaction.
269
+
270
+ {{< example class="flex justify-center" github="components/dropdowns.md" show_dark=true iframeHeight="290" >}}
271
+ <button id="dropdownCheckboxButton" data-dropdown-toggle="dropdownDefaultCheckbox" class="inline-flex items-center justify-center text-white bg-brand box-border border border-transparent hover:bg-brand-strong focus:ring-4 focus:ring-brand-medium shadow-xs font-medium leading-5 rounded-base text-sm px-4 py-2.5 focus:outline-none" type="button">
272
+ Dropdown button
273
+ <svg class="w-4 h-4 ms-1.5 -me-0.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m19 9-7 7-7-7"/></svg>
274
+ </button>
275
+ <!-- Dropdown menu -->
276
+ <div id="dropdownDefaultCheckbox" class="z-10 hidden bg-neutral-primary-medium border border-default-medium rounded-base shadow-lg w-52">
277
+ <ul class="p-4 text-sm text-body font-medium space-y-4" aria-labelledby="dropdownCheckboxButton">
278
+ <li>
279
+ <div class="flex items-center">
280
+ <input id="dropdown-checkbox" type="checkbox" value="" class="w-4 h-4 border border-default-strong rounded-xs bg-neutral-secondary-strong focus:ring-2 focus:ring-brand-soft">
281
+ <label for="dropdown-checkbox" class="ms-2 text-sm font-medium text-heading">Default checkbox</label>
282
+ </div>
283
+ </li>
284
+ <li>
285
+ <div class="flex items-center">
286
+ <input checked id="dropdown-checkbox-2" type="checkbox" value="" class="w-4 h-4 border border-default-strong rounded-xs bg-neutral-secondary-strong focus:ring-2 focus:ring-brand-soft">
287
+ <label for="dropdown-checkbox-2" class="ms-2 text-sm font-medium text-heading">Checked state</label>
288
+ </div>
289
+ </li>
290
+ <li>
291
+ <div class="flex items-center">
292
+ <input id="dropdown-checkbox-3" type="checkbox" value="" class="w-4 h-4 border border-default-strong rounded-xs bg-neutral-secondary-strong focus:ring-2 focus:ring-brand-soft">
293
+ <label for="dropdown-checkbox-3" class="ms-2 text-sm font-medium text-heading">Default checkbox</label>
294
+ </div>
295
+ </li>
296
+ </ul>
297
+ </div>
298
+ {{< /example >}}
299
+
300
+ ### Background hover
301
+
302
+ Use this example to update the background color of a menu item when using a list of checkbox elements.
303
+
304
+ {{< example class="flex justify-center" github="components/dropdowns.md" show_dark=true iframeHeight="300" >}}
305
+ <button id="dropdownBgHoverButton" data-dropdown-toggle="dropdownBgHover" class="inline-flex items-center justify-center text-white bg-brand box-border border border-transparent hover:bg-brand-strong focus:ring-4 focus:ring-brand-medium shadow-xs font-medium leading-5 rounded-base text-sm px-4 py-2.5 focus:outline-none" type="button">
306
+ Dropdown button
307
+ <svg class="w-4 h-4 ms-1.5 -me-0.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m19 9-7 7-7-7"/></svg>
308
+ </button>
309
+
310
+ <!-- Dropdown menu -->
311
+ <div id="dropdownBgHover" class="z-10 hidden bg-neutral-primary-medium border border-default-medium rounded-base shadow-lg w-52">
312
+ <ul class="p-2 text-sm text-body font-medium" aria-labelledby="dropdownBgHoverButton">
313
+ <li>
314
+ <div class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">
315
+ <input id="dropdown-checkbox-4" type="checkbox" value="" class="w-4 h-4 border border-default-strong rounded-xs bg-neutral-secondary-strong focus:ring-2 focus:ring-brand-soft">
316
+ <label for="dropdown-checkbox-4" class="ms-2 text-sm font-medium text-heading">Default checkbox</label>
317
+ </div>
318
+ </li>
319
+ <li>
320
+ <div class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">
321
+ <input checked id="dropdown-checkbox-5" type="checkbox" value="" class="w-4 h-4 border border-default-strong rounded-xs bg-neutral-secondary-strong focus:ring-2 focus:ring-brand-soft">
322
+ <label for="dropdown-checkbox-5" class="ms-2 text-sm font-medium text-heading">Checked state</label>
323
+ </div>
324
+ </li>
325
+ <li>
326
+ <div class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">
327
+ <input id="dropdown-checkbox-6" type="checkbox" value="" class="w-4 h-4 border border-default-strong rounded-xs bg-neutral-secondary-strong focus:ring-2 focus:ring-brand-soft">
328
+ <label for="dropdown-checkbox-6" class="ms-2 text-sm font-medium text-heading">Default checkbox</label>
329
+ </div>
330
+ </li>
331
+ </ul>
332
+ </div>
333
+ {{< /example >}}
334
+
335
+ ### Helper text
336
+
337
+ Add an extra helper text to each checkbox element inside the dropdown menu list with this example.
338
+
339
+ {{< example class="flex justify-center" github="components/dropdowns.md" show_dark=true iframeHeight="380" >}}
340
+ <button id="dropdownHelperButton" data-dropdown-toggle="dropdownHelper" class="inline-flex items-center justify-center text-white bg-brand box-border border border-transparent hover:bg-brand-strong focus:ring-4 focus:ring-brand-medium shadow-xs font-medium leading-5 rounded-base text-sm px-4 py-2.5 focus:outline-none" type="button">
341
+ Dropdown button
342
+ <svg class="w-4 h-4 ms-1.5 -me-0.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m19 9-7 7-7-7"/></svg>
343
+ </button>
344
+ <!-- Dropdown menu -->
345
+ <div id="dropdownHelper" class="z-10 hidden bg-neutral-primary-medium border border-default-medium rounded-base shadow-lg w-60">
346
+ <ul class="p-2 text-sm text-body font-medium" aria-labelledby="dropdownHelperButton">
347
+ <li>
348
+ <div class="inline-flex items-start w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">
349
+ <div class="flex items-center h-5">
350
+ <input id="dropdown-checkbox-7" type="checkbox" value="" class="w-4 h-4 border border-default-strong rounded-xs bg-neutral-secondary-strong focus:ring-2 focus:ring-brand-soft">
351
+ </div>
352
+ <div class="ms-2 text-sm">
353
+ <label for="dropdown-checkbox-7" class="font-medium text-heading select-none">
354
+ <div class="mb-0.5">Enable notifications</div>
355
+ <p id="helper-checkbox-text-1" class="text-xs font-normal text-body">Some helpful instruction goes over here.</p>
356
+ </label>
357
+ </div>
358
+ </div>
359
+ </li>
360
+ <li>
361
+ <div class="inline-flex items-start w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">
362
+ <div class="flex items-center h-5">
363
+ <input id="dropdown-checkbox-8" type="checkbox" value="" class="w-4 h-4 border border-default-strong rounded-xs bg-neutral-secondary-strong focus:ring-2 focus:ring-brand-soft">
364
+ </div>
365
+ <div class="ms-2 text-sm">
366
+ <label for="dropdown-checkbox-8" class="font-medium text-heading select-none">
367
+ <div class="mb-0.5">Enable 2FA auth</div>
368
+ <p id="helper-checkbox-text-2" class="text-xs font-normal text-body">Some helpful instruction goes over here.</p>
369
+ </label>
370
+ </div>
371
+ </div>
372
+ </li>
373
+ <li>
374
+ <div class="inline-flex items-start w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">
375
+ <div class="flex items-center h-5">
376
+ <input id="dropdown-checkbox-9" type="checkbox" value="" class="w-4 h-4 border border-default-strong rounded-xs bg-neutral-secondary-strong focus:ring-2 focus:ring-brand-soft">
377
+ </div>
378
+ <div class="ms-2 text-sm">
379
+ <label for="dropdown-checkbox-9" class="font-medium text-heading select-none">
380
+ <div class="mb-0.5">Subscribe newsletter</div>
381
+ <p id="helper-checkbox-text-3" class="text-xs font-normal text-body">Some helpful instruction goes over here.</p>
382
+ </label>
383
+ </div>
384
+ </div>
385
+ </li>
386
+ </ul>
387
+ </div>
388
+ {{< /example >}}
389
+
390
+ ## Dropdown with radio
391
+
392
+ Enable more advanced interaction with your users by adding radio input elements inside the dropdown menu.
393
+
394
+ {{< example class="flex justify-center" github="components/dropdowns.md" show_dark=true iframeHeight="250" >}}
395
+ <button id="dropdownRadioButton" data-dropdown-toggle="dropdownDefaultRadio" class="inline-flex items-center justify-center text-white bg-brand box-border border border-transparent hover:bg-brand-strong focus:ring-4 focus:ring-brand-medium shadow-xs font-medium leading-5 rounded-base text-sm px-4 py-2.5 focus:outline-none" type="button">
396
+ Dropdown radio
397
+ <svg class="w-4 h-4 ms-1.5 -me-0.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m19 9-7 7-7-7"/></svg>
398
+ </button>
399
+
400
+ <!-- Dropdown menu -->
401
+ <div id="dropdownDefaultRadio" class="z-10 hidden bg-neutral-primary-medium border border-default-medium rounded-base shadow-lg w-44">
402
+ <ul class="p-3 text-sm text-body font-medium space-y-3" aria-labelledby="dropdownRadioButton">
403
+ <li>
404
+ <div class="inline-flex items-center">
405
+ <input id="dropdown-radio-1" type="radio" value="" name="default-radio" class="w-4 h-4 text-neutral-primary border-default-strong bg-neutral-secondary-strong rounded-full checked:border-brand focus:ring-2 focus:outline-none focus:ring-brand-subtle border border-default appearance-none">
406
+ <label for="dropdown-radio-1" class="select-none ms-2 text-sm font-medium text-heading">Default radio</label>
407
+ </div>
408
+ </li>
409
+ <li>
410
+ <div class="inline-flex items-center">
411
+ <input id="dropdown-radio-2" type="radio" value="" name="default-radio" class="w-4 h-4 text-neutral-primary border-default-strong bg-neutral-secondary-strong rounded-full checked:border-brand focus:ring-2 focus:outline-none focus:ring-brand-subtle border border-default appearance-none">
412
+ <label for="dropdown-radio-2" class="select-none ms-2 text-sm font-medium text-heading">Checked radio</label>
413
+ </div>
414
+ </li>
415
+ <li>
416
+ <div class="inline-flex items-center">
417
+ <input id="dropdown-radio-3" type="radio" value="" name="default-radio" class="w-4 h-4 text-neutral-primary border-default-strong bg-neutral-secondary-strong rounded-full checked:border-brand focus:ring-2 focus:outline-none focus:ring-brand-subtle border border-default appearance-none">
418
+ <label for="dropdown-radio-3" class="select-none ms-2 text-sm font-medium text-heading">Default radio</label>
419
+ </div>
420
+ </li>
421
+ </ul>
422
+ </div>
423
+ {{< /example >}}
424
+
425
+ ### Background hover
426
+
427
+ Use this example to update the background color when hovering over a menu item when using radio elements.
428
+
429
+ {{< example class="flex justify-center" github="components/dropdowns.md" show_dark=true iframeHeight="280" >}}
430
+ <button id="dropdownRadioBgHoverButton" data-dropdown-toggle="dropdownRadioBgHover" class="inline-flex items-center justify-center text-white bg-brand box-border border border-transparent hover:bg-brand-strong focus:ring-4 focus:ring-brand-medium shadow-xs font-medium leading-5 rounded-base text-sm px-4 py-2.5 focus:outline-none" type="button">
431
+ Dropdown button
432
+ <svg class="w-4 h-4 ms-1.5 -me-0.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m19 9-7 7-7-7"/></svg>
433
+ </button>
434
+
435
+ <!-- Dropdown menu -->
436
+ <div id="dropdownRadioBgHover" class="z-10 hidden bg-neutral-primary-medium border border-default-medium rounded-base shadow-lg w-44">
437
+ <ul class="p-2 text-sm text-body font-medium" aria-labelledby="dropdownRadioBgHoverButton">
438
+ <li>
439
+ <div class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">
440
+ <input id="dropdown-radio-4" type="radio" value="" name="default-radio" class="w-4 h-4 text-neutral-primary border-default-strong bg-neutral-secondary-strong rounded-full checked:border-brand focus:ring-2 focus:outline-none focus:ring-brand-subtle border border-default appearance-none">
441
+ <label for="dropdown-radio-4" class="select-none ms-2 text-sm font-medium text-heading">Default radio</label>
442
+ </div>
443
+ </li>
444
+ <li>
445
+ <div class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">
446
+ <input id="dropdown-radio-5" type="radio" value="" name="default-radio" class="w-4 h-4 text-neutral-primary border-default-strong bg-neutral-secondary-strong rounded-full checked:border-brand focus:ring-2 focus:outline-none focus:ring-brand-subtle border border-default appearance-none" checked>
447
+ <label for="dropdown-radio-5" class="select-none ms-2 text-sm font-medium text-heading">Checked radio</label>
448
+ </div>
449
+ </li>
450
+ <li>
451
+ <div class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">
452
+ <input id="dropdown-radio-6" type="radio" value="" name="default-radio" class="w-4 h-4 text-neutral-primary border-default-strong bg-neutral-secondary-strong rounded-full checked:border-brand focus:ring-2 focus:outline-none focus:ring-brand-subtle border border-default appearance-none">
453
+ <label for="dropdown-radio-6" class="select-none ms-2 text-sm font-medium text-heading">Default radio</label>
454
+ </div>
455
+ </li>
456
+ </ul>
457
+ </div>
458
+ {{< /example >}}
459
+
460
+ ### Helper text
461
+
462
+ This example can be used to add an extra helper text inside of each radio element from the dropdown menu.
463
+
464
+ {{< example class="flex justify-center" github="components/dropdowns.md" show_dark=true iframeHeight="380" >}}
465
+
466
+ <button id="dropdownHelperRadioButton" data-dropdown-toggle="dropdownHelperRadio" class="inline-flex items-center justify-center text-white bg-brand box-border border border-transparent hover:bg-brand-strong focus:ring-4 focus:ring-brand-medium shadow-xs font-medium leading-5 rounded-base text-sm px-4 py-2.5 focus:outline-none" type="button">
467
+ Dropdown button
468
+ <svg class="w-4 h-4 ms-1.5 -me-0.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m19 9-7 7-7-7"/></svg>
469
+ </button>
470
+
471
+ <!-- Dropdown menu -->
472
+ <div id="dropdownHelperRadio" class="z-10 hidden bg-neutral-primary-medium border border-default-medium rounded-base shadow-lg w-56" data-popper-reference-hidden="" data-popper-escaped="" data-popper-placement="top">
473
+ <ul class="p-2 text-sm text-body font-medium" aria-labelledby="dropdownHelperRadioButton">
474
+ <li>
475
+ <div class="flex p-2 w-full hover:bg-neutral-tertiary-medium hover:text-heading rounded">
476
+ <div class="flex items-center h-5">
477
+ <input id="helper-radio-4" name="helper-radio" type="radio" value="" class="w-4 h-4 text-neutral-primary border-default-strong bg-neutral-secondary-strong rounded-full checked:border-brand focus:ring-2 focus:outline-none focus:ring-brand-subtle border border-default appearance-none">
478
+ </div>
479
+ <div class="ms-2 text-sm">
480
+ <label for="helper-radio-4" class="font-medium text-heading">
481
+ <div class="mb-1">Individual</div>
482
+ <p id="helper-radio-text-4" class="text-xs font-normal text-body">Some helpful instruction goes over here.</p>
483
+ </label>
484
+ </div>
485
+ </div>
486
+ </li>
487
+ <li>
488
+ <div class="flex p-2 w-full hover:bg-neutral-tertiary-medium hover:text-heading rounded">
489
+ <div class="flex items-center h-5">
490
+ <input id="helper-radio-5" name="helper-radio" type="radio" value="" class="w-4 h-4 text-neutral-primary border-default-strong bg-neutral-secondary-strong rounded-full checked:border-brand focus:ring-2 focus:outline-none focus:ring-brand-subtle border border-default appearance-none">
491
+ </div>
492
+ <div class="ms-2 text-sm">
493
+ <label for="helper-radio-5" class="font-medium text-heading">
494
+ <div class="mb-1">Company</div>
495
+ <p id="helper-radio-text-5" class="text-xs font-normal text-body">Some helpful instruction goes over here.</p>
496
+ </label>
497
+ </div>
498
+ </div>
499
+ </li>
500
+ <li>
501
+ <div class="flex p-2 w-full hover:bg-neutral-tertiary-medium hover:text-heading rounded">
502
+ <div class="flex items-center h-5">
503
+ <input id="helper-radio-6" name="helper-radio" type="radio" value="" class="w-4 h-4 text-neutral-primary border-default-strong bg-neutral-secondary-strong rounded-full checked:border-brand focus:ring-2 focus:outline-none focus:ring-brand-subtle border border-default appearance-none">
504
+ </div>
505
+ <div class="ms-2 text-sm">
506
+ <label for="helper-radio-6" class="font-medium text-heading">
507
+ <div class="mb-1">Non profit</div>
508
+ <p id="helper-radio-text-6" class="text-xs font-normal text-body">Some helpful instruction goes over here.</p>
509
+ </label>
510
+ </div>
511
+ </div>
512
+ </li>
513
+ </ul>
514
+ </div>
515
+ {{< /example >}}
516
+
517
+ ## Dropdown with toggle switch
518
+
519
+ Show a list of toggle switch elements inside the dropdown menu to enable a yes or no type of choice.
520
+
521
+ {{< example class="flex justify-center" github="components/dropdowns.md" show_dark=true iframeHeight="280" >}}
522
+ <button id="dropdownToggleButton" data-dropdown-toggle="dropdownToggle" class="inline-flex items-center justify-center text-white bg-brand box-border border border-transparent hover:bg-brand-strong focus:ring-4 focus:ring-brand-medium shadow-xs font-medium leading-5 rounded-base text-sm px-4 py-2.5 focus:outline-none" type="button">
523
+ Dropdown button
524
+ <svg class="w-4 h-4 ms-1.5 -me-0.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m19 9-7 7-7-7"/></svg>
525
+ </button>
526
+
527
+ <!-- Dropdown menu -->
528
+ <div id="dropdownToggle" class="z-10 hidden bg-neutral-primary-medium border border-default-medium rounded-base shadow-lg w-72">
529
+ <ul class="p-2 space-y-1 text-sm text-body font-medium" aria-labelledby="dropdownToggleButton">
530
+ <li>
531
+ <div class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">
532
+ <label class="inline-flex items-center cursor-pointer">
533
+ <input type="checkbox" value="" class="sr-only peer">
534
+ <div class="relative w-9 h-5 bg-neutral-quaternary peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-brand-soft dark:peer-focus:ring-brand-soft rounded-full peer peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-buffer after:content-[''] after:absolute after:top-[2px] after:start-[2px] after:bg-white after:rounded-full after:h-4 after:w-4 after:transition-all peer-checked:bg-brand"></div>
535
+ <span class="ms-3 text-sm font-medium text-heading">Enable notifications</span>
536
+ </label>
537
+ </div>
538
+ </li>
539
+ <li>
540
+ <div class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">
541
+ <label class="inline-flex items-center cursor-pointer">
542
+ <input type="checkbox" value="" class="sr-only peer">
543
+ <div class="relative w-9 h-5 bg-neutral-quaternary peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-brand-soft dark:peer-focus:ring-brand-soft rounded-full peer peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-buffer after:content-[''] after:absolute after:top-[2px] after:start-[2px] after:bg-white after:rounded-full after:h-4 after:w-4 after:transition-all peer-checked:bg-brand"></div>
544
+ <span class="ms-3 text-sm font-medium text-heading">Enable 2FA authentication</span>
545
+ </label>
546
+ </div>
547
+ </li>
548
+ <li>
549
+ <div class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">
550
+ <label class="inline-flex items-center cursor-pointer">
551
+ <input type="checkbox" value="" class="sr-only peer">
552
+ <div class="relative w-9 h-5 bg-neutral-quaternary peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-brand-soft dark:peer-focus:ring-brand-soft rounded-full peer peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-buffer after:content-[''] after:absolute after:top-[2px] after:start-[2px] after:bg-white after:rounded-full after:h-4 after:w-4 after:transition-all peer-checked:bg-brand"></div>
553
+ <span class="ms-3 text-sm font-medium text-heading">Subscribe to newsletter</span>
554
+ </label>
555
+ </div>
556
+ </li>
557
+ </ul>
558
+ </div>
559
+
560
+ {{< /example >}}
561
+
562
+ ## Dropdown with scrolling
563
+
564
+ This example can be used when you want to show a long list of items that won't affect the height of the dropdown menu by enabling a scrolling behaviour.
565
+
566
+ {{< example class="flex justify-center" github="components/dropdowns.md" show_dark=true iframeHeight="380" >}}
567
+ <button id="dropdownUsersButton" data-dropdown-toggle="dropdownUsers" data-dropdown-placement="bottom" class="inline-flex items-center justify-center text-white bg-brand box-border border border-transparent hover:bg-brand-strong focus:ring-4 focus:ring-brand-medium shadow-xs font-medium leading-5 rounded-base text-sm px-4 py-2.5 focus:outline-none" type="button">
568
+ Dropdown button
569
+ <svg class="w-4 h-4 ms-1.5 -me-0.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m19 9-7 7-7-7"/></svg>
570
+ </button>
571
+
572
+ <!-- Dropdown menu -->
573
+ <div id="dropdownUsers" class="z-10 hidden bg-neutral-primary-medium border border-default-medium rounded-base shadow-lg w-54">
574
+ <ul class="h-48 p-2 text-sm text-body font-medium overflow-y-auto" aria-labelledby="dropdownUsersButton">
575
+ <li>
576
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">
577
+ <img class="w-5 h-5 me-2 rounded-full" src="/docs/images/people/profile-picture-1.jpg" alt="Jese image">
578
+ Jese Leos
579
+ </a>
580
+ </li>
581
+ <li>
582
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">
583
+ <img class="w-5 h-5 me-2 rounded-full" src="/docs/images/people/profile-picture-2.jpg" alt="Jese image">
584
+ Robert Gough
585
+ </a>
586
+ </li>
587
+ <li>
588
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">
589
+ <img class="w-5 h-5 me-2 rounded-full" src="/docs/images/people/profile-picture-3.jpg" alt="Jese image">
590
+ Bonnie Green
591
+ </a>
592
+ </li>
593
+ <li>
594
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">
595
+ <img class="w-5 h-5 me-2 rounded-full" src="/docs/images/people/profile-picture-4.jpg" alt="Jese image">
596
+ Leslie Livingston
597
+ </a>
598
+ </li>
599
+ <li>
600
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">
601
+ <img class="w-5 h-5 me-2 rounded-full" src="/docs/images/people/profile-picture-5.jpg" alt="Jese image">
602
+ Michael Gough
603
+ </a>
604
+ </li>
605
+ <li>
606
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">
607
+ <img class="w-5 h-5 me-2 rounded-full" src="/docs/images/people/profile-picture-2.jpg" alt="Jese image">
608
+ Joseph Mcfall
609
+ </a>
610
+ </li>
611
+ <li>
612
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">
613
+ <img class="w-5 h-5 me-2 rounded-full" src="/docs/images/people/profile-picture-3.jpg" alt="Jese image">
614
+ Roberta Casas
615
+ </a>
616
+ </li>
617
+ <li>
618
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">
619
+ <img class="w-5 h-5 me-2 rounded-full" src="/docs/images/people/profile-picture-1.jpg" alt="Jese image">
620
+ Neil Sims
621
+ </a>
622
+ </li>
623
+ </ul>
624
+ <div class="bg-neutral-primary-medium border-t border-default-medium p-2 rounded-b-base">
625
+ <button type="button" class="inline-flex items-center w-full justify-center text-white bg-brand hover:bg-brand-strong box-border border border-transparent focus:ring-4 focus:ring-brand-medium shadow-xs font-medium leading-5 rounded text-xs px-3 py-1.5 focus:outline-none">
626
+ <svg class="w-3.5 h-3.5 me-1.5 -ms-0.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 12h4m-2 2v-4M4 18v-1a3 3 0 0 1 3-3h4a3 3 0 0 1 3 3v1a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1Zm8-10a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"/></svg>
627
+ Add new user
628
+ </button>
629
+ </div>
630
+ </div>
631
+ {{< /example >}}
632
+
633
+ ## Scrollable checkboxes
634
+
635
+ Use this example to show multiple dropdown items in a scrollable container with checkboxes.
636
+
637
+ {{< example class="flex justify-center" github="components/dropdowns.md" show_dark=true iframeHeight="380" >}}
638
+ <button id="dropdownUsersAdvancedButton" data-dropdown-toggle="dropdownAdvanced" data-dropdown-placement="bottom" class="inline-flex items-center justify-center text-white bg-brand box-border border border-transparent hover:bg-brand-strong focus:ring-4 focus:ring-brand-medium shadow-xs font-medium leading-5 rounded-base text-sm px-4 py-2.5 focus:outline-none" type="button">
639
+ Dropdown button
640
+ <svg class="w-4 h-4 ms-1.5 -me-0.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m19 9-7 7-7-7"/></svg>
641
+ </button>
642
+
643
+ <!-- Dropdown menu -->
644
+ <div id="dropdownAdvanced" class="z-10 hidden bg-neutral-primary-medium border border-default-medium rounded-base shadow-lg w-54">
645
+ <ul class="h-48 p-2 text-sm text-body font-medium overflow-y-auto" aria-labelledby="dropdownAdvancedButton">
646
+ <li class="w-full flex items-center p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">
647
+ <label for="dropdown-user-1" class="w-full flex items-center justify-between">
648
+ <div class="inline-flex items-center font-medium">
649
+ <img class="w-5 h-5 me-2 rounded-full" src="/docs/images/people/profile-picture-1.jpg" alt="Jese image">
650
+ Jese Leos
651
+ </div>
652
+ <input id="dropdown-user-1" type="checkbox" value="" class="w-4 h-4 border border-default-strong rounded-xs bg-neutral-secondary-strong focus:ring-2 focus:ring-brand-soft">
653
+ </label>
654
+ </li>
655
+ <li class="w-full flex items-center p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">
656
+ <label for="dropdown-user-2" class="w-full flex items-center justify-between">
657
+ <div class="inline-flex items-center font-medium">
658
+ <img class="w-5 h-5 me-2 rounded-full" src="/docs/images/people/profile-picture-2.jpg" alt="Robert image">
659
+ Robert Gough
660
+ </div>
661
+ <input id="dropdown-user-2" type="checkbox" value="" class="w-4 h-4 border border-default-strong rounded-xs bg-neutral-secondary-strong focus:ring-2 focus:ring-brand-soft">
662
+ </label>
663
+ </li>
664
+ <li class="w-full flex items-center p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">
665
+ <label for="dropdown-user-3" class="w-full flex items-center justify-between">
666
+ <div class="inline-flex items-center font-medium">
667
+ <img class="w-5 h-5 me-2 rounded-full" src="/docs/images/people/profile-picture-3.jpg" alt="Bonnie image">
668
+ Bonnie Green
669
+ </div>
670
+ <input id="dropdown-user-3" type="checkbox" value="" class="w-4 h-4 border border-default-strong rounded-xs bg-neutral-secondary-strong focus:ring-2 focus:ring-brand-soft">
671
+ </label>
672
+ </li>
673
+ <li class="w-full flex items-center p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">
674
+ <label for="dropdown-user-4" class="w-full flex items-center justify-between">
675
+ <div class="inline-flex items-center font-medium">
676
+ <img class="w-5 h-5 me-2 rounded-full" src="/docs/images/people/profile-picture-4.jpg" alt="Leslie image">
677
+ Leslie Livingston
678
+ </div>
679
+ <input id="dropdown-user-4" type="checkbox" value="" class="w-4 h-4 border border-default-strong rounded-xs bg-neutral-secondary-strong focus:ring-2 focus:ring-brand-soft">
680
+ </label>
681
+ </li>
682
+ <li class="w-full flex items-center p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">
683
+ <label for="dropdown-user-5" class="w-full flex items-center justify-between">
684
+ <div class="inline-flex items-center font-medium">
685
+ <img class="w-5 h-5 me-2 rounded-full" src="/docs/images/people/profile-picture-5.jpg" alt="Michael image">
686
+ Michael Gough
687
+ </div>
688
+ <input id="dropdown-user-5" type="checkbox" value="" class="w-4 h-4 border border-default-strong rounded-xs bg-neutral-secondary-strong focus:ring-2 focus:ring-brand-soft">
689
+ </label>
690
+ </li>
691
+ <li class="w-full flex items-center p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">
692
+ <label for="dropdown-user-6" class="w-full flex items-center justify-between">
693
+ <div class="inline-flex items-center font-medium">
694
+ <img class="w-5 h-5 me-2 rounded-full" src="/docs/images/people/profile-picture-2.jpg" alt="Joseph image">
695
+ Joseph Mcfall
696
+ </div>
697
+ <input id="dropdown-user-6" type="checkbox" value="" class="w-4 h-4 border border-default-strong rounded-xs bg-neutral-secondary-strong focus:ring-2 focus:ring-brand-soft">
698
+ </label>
699
+ </li>
700
+ <li class="w-full flex items-center p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">
701
+ <label for="dropdown-user-7" class="w-full flex items-center justify-between">
702
+ <div class="inline-flex items-center font-medium">
703
+ <img class="w-5 h-5 me-2 rounded-full" src="/docs/images/people/profile-picture-4.jpg" alt="Roberta image">
704
+ Roberta Casas
705
+ </div>
706
+ <input id="dropdown-user-7" type="checkbox" value="" class="w-4 h-4 border border-default-strong rounded-xs bg-neutral-secondary-strong focus:ring-2 focus:ring-brand-soft">
707
+ </label>
708
+ </li>
709
+ <li class="w-full flex items-center p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">
710
+ <label for="dropdown-user-7" class="w-full flex items-center justify-between">
711
+ <div class="inline-flex items-center font-medium">
712
+ <img class="w-5 h-5 me-2 rounded-full" src="/docs/images/people/profile-picture-1.jpg" alt="Neil image">
713
+ Neil Sims
714
+ </div>
715
+ <input id="dropdown-user-8" type="checkbox" value="" class="w-4 h-4 border border-default-strong rounded-xs bg-neutral-secondary-strong focus:ring-2 focus:ring-brand-soft">
716
+ </label>
717
+ </li>
718
+ </ul>
719
+ <div class="bg-neutral-primary-medium border-t border-default-medium p-2 rounded-b-base">
720
+ <button type="button" class="w-full inline-flex items-center justify-center text-white bg-danger box-border border border-transparent hover:bg-danger-strong focus:ring-4 focus:ring-danger-medium shadow-xs font-medium leading-5 rounded text-xs px-3 py-1.5 focus:outline-none">
721
+ <svg class="w-3.5 h-3.5 me-1.5 -ms-0.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 7h14m-9 3v8m4-8v8M10 3h4a1 1 0 0 1 1 1v3H9V4a1 1 0 0 1 1-1ZM6 7h12v13a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V7Z"/></svg>
722
+ Delete user
723
+ </button>
724
+ </div>
725
+ </div>
726
+ {{< /example >}}
727
+
728
+ ## Dropdown with search
729
+
730
+ Use this example if you want to add a search bar inside the dropdown menu to be able to filter through a long list of menu items with scrolling behaviour.
731
+
732
+ {{< example class="flex justify-center" github="components/dropdowns.md" show_dark=true iframeHeight="440" >}}
733
+ <button id="dropdownUsersSearchButton" data-dropdown-toggle="dropdownSearch" data-dropdown-placement="bottom" class="inline-flex items-center justify-center text-white bg-brand box-border border border-transparent hover:bg-brand-strong focus:ring-4 focus:ring-brand-medium shadow-xs font-medium leading-5 rounded-base text-sm px-4 py-2.5 focus:outline-none" type="button">
734
+ Dropdown button
735
+ <svg class="w-4 h-4 ms-1.5 -me-0.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m19 9-7 7-7-7"/></svg>
736
+ </button>
737
+
738
+ <!-- Dropdown menu -->
739
+ <div id="dropdownSearch" class="z-10 hidden bg-neutral-primary-medium border border-default-medium rounded-base shadow-lg w-54">
740
+ <div class="bg-neutral-primary-medium border-b border-default-medium p-2 rounded-t-base">
741
+ <label for="search" class="sr-only">Search</label>
742
+ <input type="text" id="search" class="bg-neutral-secondary-strong border border-default-strong text-heading text-sm rounded focus:ring-brand focus:border-brand block w-full px-2.5 py-2 shadow-xs placeholder:text-body" placeholder="Search for users" required />
743
+ </div>
744
+ <ul class="h-48 p-2 text-sm text-body font-medium overflow-y-auto" aria-labelledby="dropdownSearchButton">
745
+ <li class="w-full flex items-center p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">
746
+ <label for="dropdown-user-9" class="w-full flex items-center justify-between">
747
+ <div class="inline-flex items-center font-medium">
748
+ <img class="w-5 h-5 me-2 rounded-full" src="/docs/images/people/profile-picture-1.jpg" alt="Jese image">
749
+ Jese Leos
750
+ </div>
751
+ <input id="dropdown-user-9" type="checkbox" value="" class="w-4 h-4 border border-default-strong rounded-xs bg-neutral-secondary-strong focus:ring-2 focus:ring-brand-soft">
752
+ </label>
753
+ </li>
754
+ <li class="w-full flex items-center p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">
755
+ <label for="dropdown-user-10" class="w-full flex items-center justify-between">
756
+ <div class="inline-flex items-center font-medium">
757
+ <img class="w-5 h-5 me-2 rounded-full" src="/docs/images/people/profile-picture-2.jpg" alt="Robert image">
758
+ Robert Gough
759
+ </div>
760
+ <input id="dropdown-user-10" type="checkbox" value="" class="w-4 h-4 border border-default-strong rounded-xs bg-neutral-secondary-strong focus:ring-2 focus:ring-brand-soft">
761
+ </label>
762
+ </li>
763
+ <li class="w-full flex items-center p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">
764
+ <label for="dropdown-user-11" class="w-full flex items-center justify-between">
765
+ <div class="inline-flex items-center font-medium">
766
+ <img class="w-5 h-5 me-2 rounded-full" src="/docs/images/people/profile-picture-3.jpg" alt="Bonnie image">
767
+ Bonnie Green
768
+ </div>
769
+ <input id="dropdown-user-11" type="checkbox" value="" class="w-4 h-4 border border-default-strong rounded-xs bg-neutral-secondary-strong focus:ring-2 focus:ring-brand-soft">
770
+ </label>
771
+ </li>
772
+ <li class="w-full flex items-center p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">
773
+ <label for="dropdown-user-12" class="w-full flex items-center justify-between">
774
+ <div class="inline-flex items-center font-medium">
775
+ <img class="w-5 h-5 me-2 rounded-full" src="/docs/images/people/profile-picture-4.jpg" alt="Leslie image">
776
+ Leslie Livingston
777
+ </div>
778
+ <input id="dropdown-user-12" type="checkbox" value="" class="w-4 h-4 border border-default-strong rounded-xs bg-neutral-secondary-strong focus:ring-2 focus:ring-brand-soft">
779
+ </label>
780
+ </li>
781
+ <li class="w-full flex items-center p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">
782
+ <label for="dropdown-user-13" class="w-full flex items-center justify-between">
783
+ <div class="inline-flex items-center font-medium">
784
+ <img class="w-5 h-5 me-2 rounded-full" src="/docs/images/people/profile-picture-5.jpg" alt="Michael image">
785
+ Michael Gough
786
+ </div>
787
+ <input id="dropdown-user-13" type="checkbox" value="" class="w-4 h-4 border border-default-strong rounded-xs bg-neutral-secondary-strong focus:ring-2 focus:ring-brand-soft">
788
+ </label>
789
+ </li>
790
+ <li class="w-full flex items-center p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">
791
+ <label for="dropdown-user-14" class="w-full flex items-center justify-between">
792
+ <div class="inline-flex items-center font-medium">
793
+ <img class="w-5 h-5 me-2 rounded-full" src="/docs/images/people/profile-picture-2.jpg" alt="Joseph image">
794
+ Joseph Mcfall
795
+ </div>
796
+ <input id="dropdown-user-14" type="checkbox" value="" class="w-4 h-4 border border-default-strong rounded-xs bg-neutral-secondary-strong focus:ring-2 focus:ring-brand-soft">
797
+ </label>
798
+ </li>
799
+ <li class="w-full flex items-center p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">
800
+ <label for="dropdown-user-15" class="w-full flex items-center justify-between">
801
+ <div class="inline-flex items-center font-medium">
802
+ <img class="w-5 h-5 me-2 rounded-full" src="/docs/images/people/profile-picture-4.jpg" alt="Roberta image">
803
+ Roberta Casas
804
+ </div>
805
+ <input id="dropdown-user-15" type="checkbox" value="" class="w-4 h-4 border border-default-strong rounded-xs bg-neutral-secondary-strong focus:ring-2 focus:ring-brand-soft">
806
+ </label>
807
+ </li>
808
+ <li class="w-full flex items-center p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">
809
+ <label for="dropdown-user-16" class="w-full flex items-center justify-between">
810
+ <div class="inline-flex items-center font-medium">
811
+ <img class="w-5 h-5 me-2 rounded-full" src="/docs/images/people/profile-picture-1.jpg" alt="Neil image">
812
+ Neil Sims
813
+ </div>
814
+ <input id="dropdown-user-16" type="checkbox" value="" class="w-4 h-4 border border-default-strong rounded-xs bg-neutral-secondary-strong focus:ring-2 focus:ring-brand-soft">
815
+ </label>
816
+ </li>
817
+ </ul>
818
+ <div class="bg-neutral-primary-medium border-t border-default-medium p-2 rounded-b-base">
819
+ <button type="button" class="w-full inline-flex items-center justify-center text-white bg-danger box-border border border-transparent hover:bg-danger-strong focus:ring-4 focus:ring-danger-medium shadow-xs font-medium leading-5 rounded text-xs px-3 py-1.5 focus:outline-none">
820
+ <svg class="w-3.5 h-3.5 me-1.5 -ms-0.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 7h14m-9 3v8m4-8v8M10 3h4a1 1 0 0 1 1 1v3H9V4a1 1 0 0 1 1-1ZM6 7h12v13a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V7Z"/></svg>
821
+ Delete user
822
+ </button>
823
+ </div>
824
+ </div>
825
+ {{< /example >}}
826
+
827
+ ## Menu icon
828
+
829
+ Use the menu icon trigger element on components such as cards as an alternative element to the button.
830
+
831
+ {{< example class="flex justify-center space-x-4 rtl:space-x-reverse" github="components/dropdowns.md" show_dark=true iframeHeight="320" >}}
832
+ <button id="dropdownMenuIconButton" data-dropdown-toggle="dropdownDots" class="text-heading bg-neutral-primary box-border border border-transparent hover:bg-neutral-secondary-medium focus:ring-4 focus:ring-neutral-tertiary font-medium leading-5 rounded-base text-sm p-2 focus:outline-none" type="button">
833
+ <svg class="w-6 h-6" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="3" d="M12 6h.01M12 12h.01M12 18h.01"/></svg>
834
+ </button>
835
+
836
+ <!-- Dropdown menu -->
837
+ <div id="dropdownDots" class="z-10 hidden bg-neutral-primary-medium border border-default-medium rounded-base shadow-lg w-44">
838
+ <ul class="p-2 text-sm text-body font-medium" aria-labelledby="dropdownMenuIconButton">
839
+ <li>
840
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Dashboard</a>
841
+ </li>
842
+ <li>
843
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Settings</a>
844
+ </li>
845
+ <li>
846
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Earnings</a>
847
+ </li>
848
+ </ul>
849
+ <div class="p-2 text-sm text-body font-medium border-t border-default-medium">
850
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Separated link</a>
851
+ </div>
852
+ </div>
853
+
854
+ <button id="dropdownMenuIconHorizontalButton" data-dropdown-toggle="dropdownDotsHorizontal" class="text-heading bg-neutral-primary box-border border border-transparent hover:bg-neutral-secondary-medium focus:ring-4 focus:ring-neutral-tertiary font-medium leading-5 rounded-base text-sm p-2 focus:outline-none" type="button">
855
+ <svg class="w-6 h-6" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="3" d="M6 12h.01m6 0h.01m5.99 0h.01"/></svg>
856
+ </button>
857
+
858
+ <!-- Dropdown menu -->
859
+ <div id="dropdownDotsHorizontal" class="z-10 hidden bg-neutral-primary-medium border border-default-medium rounded-base shadow-lg w-44 dark:divide-gray-600">
860
+ <ul class="p-2 text-sm text-body font-medium" aria-labelledby="dropdownMenuIconHorizontalButton">
861
+ <li>
862
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Dashboard</a>
863
+ </li>
864
+ <li>
865
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Settings</a>
866
+ </li>
867
+ <li>
868
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Earnings</a>
869
+ </li>
870
+ </ul>
871
+ <div class="p-2 text-sm text-body font-medium border-t border-default">
872
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Separated link</a>
873
+ </div>
874
+ </div>
875
+ {{< /example >}}
876
+
877
+ ## Notification bell
878
+
879
+ Use this example to show a list of notifications inside your application by providing more detailed information such as the user avatar, content and time of notification triggered by a notification bell icon.
880
+
881
+ {{< example class="flex justify-center" github="components/dropdowns.md" show_dark=true iframeHeight="660" >}}
882
+
883
+ <button id="dropdownNotificationButton" data-dropdown-toggle="dropdownNotification" class="relative inline-flex items-center text-sm font-medium text-center text-body hover:text-heading focus:outline-none" type="button">
884
+ <svg class="w-6 h-6" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 5.365V3m0 2.365a5.338 5.338 0 0 1 5.133 5.368v1.8c0 2.386 1.867 2.982 1.867 4.175 0 .593 0 1.292-.538 1.292H5.538C5 18 5 17.301 5 16.708c0-1.193 1.867-1.789 1.867-4.175v-1.8A5.338 5.338 0 0 1 12 5.365ZM8.733 18c.094.852.306 1.54.944 2.112a3.48 3.48 0 0 0 4.646 0c.638-.572 1.236-1.26 1.33-2.112h-6.92Z"/></svg>
885
+ </svg>
886
+ <div class="absolute block w-3 h-3 bg-danger border-2 border-buffer rounded-full top-0 start-3"></div>
887
+ </button>
888
+
889
+ <!-- Dropdown menu -->
890
+ <div id="dropdownNotification" class="z-20 hidden w-full max-w-sm bg-neutral-primary-soft divide-y divide-default-medium rounded-base shadow" aria-labelledby="dropdownNotificationButton">
891
+ <div class="block px-4 py-2 font-medium text-center text-body rounded-t-base bg-neutral-secondary-medium">
892
+ Notifications
893
+ </div>
894
+ <div class="divide-y divide-default">
895
+ <a href="#" class="flex px-4 py-3 hover:bg-neutral-secondary-medium">
896
+ <div class="shrink-0">
897
+ <img class="rounded-full w-11 h-11" src="/docs/images/people/profile-picture-1.jpg" alt="Jese image">
898
+ <div class="absolute flex items-center justify-center w-5 h-5 ms-6 -mt-5 bg-brand border border-buffer-medium rounded-full">
899
+ <svg class="w-3 h-3 text-white" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M5.024 3.783A1 1 0 0 1 6 3h12a1 1 0 0 1 .976.783L20.802 12h-4.244a1.99 1.99 0 0 0-1.824 1.205 2.978 2.978 0 0 1-5.468 0A1.991 1.991 0 0 0 7.442 12H3.198l1.826-8.217ZM3 14v5a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-5h-4.43a4.978 4.978 0 0 1-9.14 0H3Zm5-7a1 1 0 0 1 1-1h6a1 1 0 1 1 0 2H9a1 1 0 0 1-1-1Zm0 2a1 1 0 0 0 0 2h8a1 1 0 1 0 0-2H8Z" clip-rule="evenodd"/></svg>
900
+ </div>
901
+ </div>
902
+ <div class="w-full ps-3">
903
+ <div class="text-body text-sm mb-1.5">New message from <span class="font-semibold text-heading">Jese Leos</span>: "Hey, what's up? All set for the presentation?"</div>
904
+ <div class="text-xs text-fg-brand">a few moments ago</div>
905
+ </div>
906
+ </a>
907
+ <a href="#" class="flex px-4 py-3 hover:bg-neutral-secondary-medium">
908
+ <div class="shrink-0">
909
+ <img class="rounded-full w-11 h-11" src="/docs/images/people/profile-picture-2.jpg" alt="Joseph image">
910
+ <div class="absolute flex items-center justify-center w-5 h-5 ms-6 -mt-5 bg-dark border border-buffer-medium rounded-full">
911
+ <svg class="w-3 h-3 text-white" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M9 4a4 4 0 1 0 0 8 4 4 0 0 0 0-8Zm-2 9a4 4 0 0 0-4 4v1a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2v-1a4 4 0 0 0-4-4H7Zm8-1a1 1 0 0 1 1-1h1v-1a1 1 0 1 1 2 0v1h1a1 1 0 1 1 0 2h-1v1a1 1 0 1 1-2 0v-1h-1a1 1 0 0 1-1-1Z" clip-rule="evenodd"/></svg>
912
+ </div>
913
+ </div>
914
+ <div class="w-full ps-3">
915
+ <div class="text-body text-sm mb-1.5"><span class="font-semibold text-heading">Joseph Mcfall</span> and <span class="font-medium text-heading">5 others</span> started following you.</div>
916
+ <div class="text-xs text-fg-brand">10 minutes ago</div>
917
+ </div>
918
+ </a>
919
+ <a href="#" class="flex px-4 py-3 hover:bg-neutral-secondary-medium">
920
+ <div class="shrink-0">
921
+ <img class="rounded-full w-11 h-11" src="/docs/images/people/profile-picture-3.jpg" alt="Bonnie image">
922
+ <div class="absolute flex items-center justify-center w-5 h-5 ms-6 -mt-5 bg-danger border border-buffer-medium rounded-full">
923
+ <svg class="w-3 h-3 text-white" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor" viewBox="0 0 24 24"><path d="m12.75 20.66 6.184-7.098c2.677-2.884 2.559-6.506.754-8.705-.898-1.095-2.206-1.816-3.72-1.855-1.293-.034-2.652.43-3.963 1.442-1.315-1.012-2.678-1.476-3.973-1.442-1.515.04-2.825.76-3.724 1.855-1.806 2.201-1.915 5.823.772 8.706l6.183 7.097c.19.216.46.34.743.34a.985.985 0 0 0 .743-.34Z"/></svg>
924
+ </div>
925
+ </div>
926
+ <div class="w-full ps-3">
927
+ <div class="text-body text-sm mb-1.5"><span class="font-semibold text-heading">Bonnie Green</span> and <span class="font-medium text-heading">141 others</span> love your story. See it and view more stories.</div>
928
+ <div class="text-xs text-fg-brand">44 minutes ago</div>
929
+ </div>
930
+ </a>
931
+ <a href="#" class="flex px-4 py-3 hover:bg-neutral-secondary-medium">
932
+ <div class="shrink-0">
933
+ <img class="rounded-full w-11 h-11" src="/docs/images/people/profile-picture-4.jpg" alt="Leslie image">
934
+ <div class="absolute flex items-center justify-center w-5 h-5 ms-6 -mt-5 bg-success border border-buffer-medium rounded-full">
935
+ <svg class="w-3 h-3 text-white" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M3 6a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-6.616l-2.88 2.592C8.537 20.461 7 19.776 7 18.477V17H5a2 2 0 0 1-2-2V6Zm4 2a1 1 0 0 0 0 2h5a1 1 0 1 0 0-2H7Zm8 0a1 1 0 1 0 0 2h2a1 1 0 1 0 0-2h-2Zm-8 3a1 1 0 1 0 0 2h2a1 1 0 1 0 0-2H7Zm5 0a1 1 0 1 0 0 2h5a1 1 0 1 0 0-2h-5Z" clip-rule="evenodd"/></svg>
936
+ </div>
937
+ </div>
938
+ <div class="w-full ps-3">
939
+ <div class="text-body text-sm mb-1.5"><span class="font-semibold text-heading">Leslie Livingston</span> mentioned you in a comment: <span class="font-medium text-fg-brand" href="#">@bonnie.green</span> what do you say?</div>
940
+ <div class="text-xs text-fg-brand">1 hour ago</div>
941
+ </div>
942
+ </a>
943
+ <a href="#" class="flex px-4 py-3 hover:bg-neutral-secondary-medium">
944
+ <div class="shrink-0">
945
+ <img class="rounded-full w-11 h-11" src="/docs/images/people/profile-picture-5.jpg" alt="Robert image">
946
+ <div class="absolute flex items-center justify-center w-5 h-5 ms-6 -mt-5 bg-purple border border-buffer-medium rounded-full">
947
+ <svg class="w-3 h-3 text-white" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M14 7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V7Zm2 9.387 4.684 1.562A1 1 0 0 0 22 17V7a1 1 0 0 0-1.316-.949L16 7.613v8.774Z" clip-rule="evenodd"/></svg>
948
+ </div>
949
+ </div>
950
+ <div class="w-full ps-3">
951
+ <div class="text-body text-sm mb-1.5"><span class="font-semibold text-heading">Robert Brown</span> posted a new video: Glassmorphism - learn how to implement the new design trend.</div>
952
+ <div class="text-xs text-fg-brand">3 hours ago</div>
953
+ </div>
954
+ </a>
955
+ </div>
956
+ <a href="#" class="block py-2 font-medium text-center text-body rounded-b-base bg-neutral-secondary-medium hover:bg-neutral-tertiary-medium">
957
+ <div class="inline-flex items-center ">
958
+ <svg class="w-5 h-5 me-1.5 text-body" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-width="2" d="M21 12c0 1.2-4.03 6-9 6s-9-4.8-9-6c0-1.2 4.03-6 9-6s9 4.8 9 6Z"/><path stroke="currentColor" stroke-width="2" d="M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"/></svg>
959
+ View all
960
+ </div>
961
+ </a>
962
+ </div>
963
+ {{< /example >}}
964
+
965
+ ## User avatar
966
+
967
+ This example can be used to show a list of menu items and options when a user is logged into your application.
968
+
969
+ {{< example class="flex justify-center" github="components/dropdowns.md" show_dark=true iframeHeight="520" >}}
970
+ <button id="dropdownUserAvatarButton" data-dropdown-toggle="dropdownAvatar" class="flex text-sm bg-dark rounded-full md:me-0 focus:ring-4 focus:ring-neutral-quaternary" type="button">
971
+ <span class="sr-only">Open user menu</span>
972
+ <img class="w-8 h-8 rounded-full" src="/docs/images/people/profile-picture-5.jpg" alt="user photo">
973
+ </button>
974
+
975
+ <!-- Dropdown menu -->
976
+ <div id="dropdownAvatar" class="z-10 hidden bg-neutral-primary-medium border border-default-medium rounded-base shadow-lg w-72">
977
+ <div class="p-2">
978
+ <div class="flex items-center px-2.5 p-2 space-x-1.5 text-sm bg-neutral-secondary-strong rounded">
979
+ <img class="w-8 h-8 rounded-full" src="/docs/images/people/profile-picture-5.jpg" alt="Rounded avatar">
980
+ <div class="text-sm">
981
+ <div class="font-medium text-heading">Joseph McFall</div>
982
+ <div class="truncate text-body">name@flowbite.com</div>
983
+ </div>
984
+ <span class="bg-brand-softer border border-brand-subtle text-fg-brand-strong text-xs font-medium px-1.5 py-0.5 rounded ms-auto">PRO</span>
985
+ </div>
986
+ </div>
987
+ <ul class="px-2 pb-2 text-sm text-body font-medium" aria-labelledby="dropdownAvatarButton">
988
+ <li>
989
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">
990
+ <svg class="w-4 h-4 me-1.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-width="2" d="M7 17v1a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1v-1a3 3 0 0 0-3-3h-4a3 3 0 0 0-3 3Zm8-9a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"/></svg>
991
+ Account
992
+ </a>
993
+ </li>
994
+ <li>
995
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">
996
+ <svg class="w-4 h-4 me-1.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M20 6H10m0 0a2 2 0 1 0-4 0m4 0a2 2 0 1 1-4 0m0 0H4m16 6h-2m0 0a2 2 0 1 0-4 0m4 0a2 2 0 1 1-4 0m0 0H4m16 6H10m0 0a2 2 0 1 0-4 0m4 0a2 2 0 1 1-4 0m0 0H4"/></svg>
997
+ Settings
998
+ </a>
999
+ </li>
1000
+ <li>
1001
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">
1002
+ <svg class="w-4 h-4 me-1.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 14v3m-3-6V7a3 3 0 1 1 6 0v4m-8 0h10a1 1 0 0 1 1 1v7a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1v-7a1 1 0 0 1 1-1Z"/></svg>
1003
+ Privacy
1004
+ </a>
1005
+ </li>
1006
+ <li>
1007
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">
1008
+ <svg class="w-4 h-4 me-1.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 5.365V3m0 2.365a5.338 5.338 0 0 1 5.133 5.368v1.8c0 2.386 1.867 2.982 1.867 4.175 0 .593 0 1.292-.538 1.292H5.538C5 18 5 17.301 5 16.708c0-1.193 1.867-1.789 1.867-4.175v-1.8A5.338 5.338 0 0 1 12 5.365ZM8.733 18c.094.852.306 1.54.944 2.112a3.48 3.48 0 0 0 4.646 0c.638-.572 1.236-1.26 1.33-2.112h-6.92Z"/></svg>
1009
+ Notifications
1010
+ </a>
1011
+ </li>
1012
+ <li>
1013
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">
1014
+ <svg class="w-4 h-4 me-1.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9.529 9.988a2.502 2.502 0 1 1 5 .191A2.441 2.441 0 0 1 12 12.582V14m-.01 3.008H12M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"/></svg>
1015
+ Help center
1016
+ </a>
1017
+ </li>
1018
+ <li class="flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded mb-1.5">
1019
+ <a href="#" class="inline-flex items-center">
1020
+ <svg class="w-4 h-4 me-1.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 21a9 9 0 0 1-.5-17.986V3c-.354.966-.5 1.911-.5 3a9 9 0 0 0 9 9c.239 0 .254.018.488 0A9.004 9.004 0 0 1 12 21Z"/></svg>
1021
+ Dark mode
1022
+ </a>
1023
+ <label class="inline-flex items-center cursor-pointer ms-auto">
1024
+ <input type="checkbox" value="" class="sr-only peer">
1025
+ <div class="relative w-9 h-5 bg-neutral-quaternary peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-brand-soft dark:peer-focus:ring-brand-soft rounded-full peer peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-buffer after:content-[''] after:absolute after:top-[2px] after:start-[2px] after:bg-white after:rounded-full after:h-4 after:w-4 after:transition-all peer-checked:bg-brand"></div>
1026
+ <span class="ms-3 text-sm font-medium text-heading sr-only">Toggle me</span>
1027
+ </label>
1028
+ </li>
1029
+ <li class="border-t border-default-medium pt-1.5">
1030
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">
1031
+ <svg class="w-4 h-4 me-1.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m10.051 8.102-3.778.322-1.994 1.994a.94.94 0 0 0 .533 1.6l2.698.316m8.39 1.617-.322 3.78-1.994 1.994a.94.94 0 0 1-1.595-.533l-.4-2.652m8.166-11.174a1.366 1.366 0 0 0-1.12-1.12c-1.616-.279-4.906-.623-6.38.853-1.671 1.672-5.211 8.015-6.31 10.023a.932.932 0 0 0 .162 1.111l.828.835.833.832a.932.932 0 0 0 1.111.163c2.008-1.102 8.35-4.642 10.021-6.312 1.475-1.478 1.133-4.77.855-6.385Zm-2.961 3.722a1.88 1.88 0 1 1-3.76 0 1.88 1.88 0 0 1 3.76 0Z"/></svg>
1032
+ Upgrade to PRO
1033
+ </a>
1034
+ </li>
1035
+ <li>
1036
+ <a href="#" class="inline-flex items-center w-full p-2 text-fg-danger hover:bg-neutral-tertiary-medium rounded">
1037
+ <svg class="w-4 h-4 me-1.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20 12H8m12 0-4 4m4-4-4-4M9 4H7a3 3 0 0 0-3 3v10a3 3 0 0 0 3 3h2"/></svg>
1038
+ Sign out
1039
+ </a>
1040
+ </li>
1041
+ </ul>
1042
+ </div>
1043
+ {{< /example >}}
1044
+
1045
+ ### Avatar with name
1046
+
1047
+ Use this example to also show the name or email of the user next to the avatar for the dropdown menu.
1048
+
1049
+ {{< example class="flex justify-center" github="components/dropdowns.md" show_dark=true iframeHeight="520" >}}
1050
+ <button id="dropdownAvatarNameButton" data-dropdown-toggle="dropdownAvatarName" class="flex items-center text-sm pe-1 font-medium text-heading rounded-full hover:text-fg-brand md:me-0 focus:ring-4 focus:ring-neutral-tertiary" type="button">
1051
+ <span class="sr-only">Open user menu</span>
1052
+ <img class="w-8 h-8 me-2 rounded-full" src="/docs/images/people/profile-picture-5.jpg" alt="user photo">
1053
+ Joseph McFall
1054
+ <svg class="w-4 h-4 ms-2" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m19 9-7 7-7-7"/></svg>
1055
+ </button>
1056
+
1057
+ <!-- Dropdown menu -->
1058
+ <div id="dropdownAvatarName" class="z-10 hidden bg-neutral-primary-medium border border-default-medium rounded-base shadow-lg w-72">
1059
+ <div class="p-2">
1060
+ <div class="flex items-center px-2.5 p-2 space-x-1.5 text-sm bg-neutral-secondary-strong rounded">
1061
+ <img class="w-8 h-8 rounded-full" src="/docs/images/people/profile-picture-5.jpg" alt="Rounded avatar">
1062
+ <div class="text-sm">
1063
+ <div class="font-medium text-heading">Joseph McFall</div>
1064
+ <div class="truncate text-body">name@flowbite.com</div>
1065
+ </div>
1066
+ <span class="bg-brand-softer border border-brand-subtle text-fg-brand-strong text-xs font-medium px-1.5 py-0.5 rounded ms-auto">PRO</span>
1067
+ </div>
1068
+ </div>
1069
+ <ul class="px-2 pb-2 text-sm text-body font-medium" aria-labelledby="dropdownAvatarNameButton">
1070
+ <li>
1071
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">
1072
+ <svg class="w-4 h-4 me-1.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-width="2" d="M7 17v1a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1v-1a3 3 0 0 0-3-3h-4a3 3 0 0 0-3 3Zm8-9a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"/></svg>
1073
+ Account
1074
+ </a>
1075
+ </li>
1076
+ <li>
1077
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">
1078
+ <svg class="w-4 h-4 me-1.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M20 6H10m0 0a2 2 0 1 0-4 0m4 0a2 2 0 1 1-4 0m0 0H4m16 6h-2m0 0a2 2 0 1 0-4 0m4 0a2 2 0 1 1-4 0m0 0H4m16 6H10m0 0a2 2 0 1 0-4 0m4 0a2 2 0 1 1-4 0m0 0H4"/></svg>
1079
+ Settings
1080
+ </a>
1081
+ </li>
1082
+ <li>
1083
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">
1084
+ <svg class="w-4 h-4 me-1.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 14v3m-3-6V7a3 3 0 1 1 6 0v4m-8 0h10a1 1 0 0 1 1 1v7a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1v-7a1 1 0 0 1 1-1Z"/></svg>
1085
+ Privacy
1086
+ </a>
1087
+ </li>
1088
+ <li>
1089
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">
1090
+ <svg class="w-4 h-4 me-1.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 5.365V3m0 2.365a5.338 5.338 0 0 1 5.133 5.368v1.8c0 2.386 1.867 2.982 1.867 4.175 0 .593 0 1.292-.538 1.292H5.538C5 18 5 17.301 5 16.708c0-1.193 1.867-1.789 1.867-4.175v-1.8A5.338 5.338 0 0 1 12 5.365ZM8.733 18c.094.852.306 1.54.944 2.112a3.48 3.48 0 0 0 4.646 0c.638-.572 1.236-1.26 1.33-2.112h-6.92Z"/></svg>
1091
+ Notifications
1092
+ </a>
1093
+ </li>
1094
+ <li>
1095
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">
1096
+ <svg class="w-4 h-4 me-1.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9.529 9.988a2.502 2.502 0 1 1 5 .191A2.441 2.441 0 0 1 12 12.582V14m-.01 3.008H12M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"/></svg>
1097
+ Help center
1098
+ </a>
1099
+ </li>
1100
+ <li class="flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded mb-1.5">
1101
+ <a href="#" class="inline-flex items-center">
1102
+ <svg class="w-4 h-4 me-1.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 21a9 9 0 0 1-.5-17.986V3c-.354.966-.5 1.911-.5 3a9 9 0 0 0 9 9c.239 0 .254.018.488 0A9.004 9.004 0 0 1 12 21Z"/></svg>
1103
+ Dark mode
1104
+ </a>
1105
+ <label class="inline-flex items-center cursor-pointer ms-auto">
1106
+ <input type="checkbox" value="" class="sr-only peer">
1107
+ <div class="relative w-9 h-5 bg-neutral-quaternary peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-brand-soft dark:peer-focus:ring-brand-soft rounded-full peer peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-buffer after:content-[''] after:absolute after:top-[2px] after:start-[2px] after:bg-white after:rounded-full after:h-4 after:w-4 after:transition-all peer-checked:bg-brand"></div>
1108
+ <span class="ms-3 text-sm font-medium text-heading sr-only">Toggle me</span>
1109
+ </label>
1110
+ </li>
1111
+ <li class="border-t border-default-medium pt-1.5">
1112
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">
1113
+ <svg class="w-4 h-4 me-1.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m10.051 8.102-3.778.322-1.994 1.994a.94.94 0 0 0 .533 1.6l2.698.316m8.39 1.617-.322 3.78-1.994 1.994a.94.94 0 0 1-1.595-.533l-.4-2.652m8.166-11.174a1.366 1.366 0 0 0-1.12-1.12c-1.616-.279-4.906-.623-6.38.853-1.671 1.672-5.211 8.015-6.31 10.023a.932.932 0 0 0 .162 1.111l.828.835.833.832a.932.932 0 0 0 1.111.163c2.008-1.102 8.35-4.642 10.021-6.312 1.475-1.478 1.133-4.77.855-6.385Zm-2.961 3.722a1.88 1.88 0 1 1-3.76 0 1.88 1.88 0 0 1 3.76 0Z"/></svg>
1114
+ Upgrade to PRO
1115
+ </a>
1116
+ </li>
1117
+ <li>
1118
+ <a href="#" class="inline-flex items-center w-full p-2 text-fg-danger hover:bg-neutral-tertiary-medium rounded">
1119
+ <svg class="w-4 h-4 me-1.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20 12H8m12 0-4 4m4-4-4-4M9 4H7a3 3 0 0 0-3 3v10a3 3 0 0 0 3 3h2"/></svg>
1120
+ Sign out
1121
+ </a>
1122
+ </li>
1123
+ </ul>
1124
+ </div>
1125
+ {{< /example >}}
1126
+
1127
+ ## Dropdown navbar
1128
+
1129
+ You can also use the dropdown element inside a navigation bar and add a second level of navigation hierarchy, but make sure to use a `button` element.
1130
+
1131
+ {{< example bodyClass="!p-0" github="components/dropdowns.md" show_dark=true iframeHeight="380" >}}
1132
+
1133
+ <nav class="bg-neutral-primary border-default">
1134
+ <div class="max-w-screen-xl flex flex-wrap items-center justify-between mx-auto px-4 py-2.5">
1135
+ <a href="#" class="flex items-center space-x-3 rtl:space-x-reverse">
1136
+ <img src="https://flowbite.com/docs/images/logo.svg" class="h-8" alt="Flowbite Logo" />
1137
+ <span class="self-center text-xl text-headings font-semibold whitespace-nowrap">Flowbite</span>
1138
+ </a>
1139
+ <button data-collapse-toggle="navbar-dropdown" type="button" class="inline-flex items-center p-2 ms-3 w-10 h-10 justify-center inline-flex items-center p-2 ms-3 w-10 h-10 justify-center text-heading bg-neutral-primary box-border border border-transparent hover:bg-neutral-secondary-medium focus:ring-4 focus:ring-neutral-tertiary font-medium leading-5 rounded-base focus:outline-none md:hidden" aria-controls="navbar-dropdown" aria-expanded="false">
1140
+ <span class="sr-only">Open main menu</span>
1141
+ <svg class="w-6 h-6" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M5 7h14M5 12h14M5 17h14"/></svg>
1142
+ </button>
1143
+ <div class="hidden w-full md:block md:w-auto" id="navbar-dropdown">
1144
+ <ul class="flex flex-col font-medium p-4 mt-4 border border-default rounded-base bg-neutral-secondary-soft md:flex-row md:mt-0 md:text-sm md:border-0 md:bg-neutral-primary md:space-x-8 md:rtl:space-x-reverse space-y-1">
1145
+ <li>
1146
+ <a href="#" class="block py-2 px-3 text-white bg-brand rounded md:bg-transparent md:text-fg-brand md:p-0 md:text-fg-brand md:dark:bg-transparent" aria-current="page">Home</a>
1147
+ </li>
1148
+ <li>
1149
+ <button id="dropdownNavbarLink" data-dropdown-toggle="dropdownNavbar" class="flex items-center justify-between w-full py-2 px-3 text-body rounded hover:bg-neutral-tertiary-medium md:hover:bg-transparent md:border-0 md:hover:text-fg-brand md:p-0 md:w-auto md:dark:hover:bg-transparent">
1150
+ Dropdown
1151
+ <svg class="w-4 h-4 ms-1.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m19 9-7 7-7-7"/></svg>
1152
+ </button>
1153
+ <!-- Dropdown menu -->
1154
+ <div id="dropdownNavbar" class="z-10 hidden bg-neutral-primary-medium border border-default-medium rounded-base shadow-lg w-44">
1155
+ <ul class="p-2 text-sm text-body font-medium" aria-labelledby="dropdownLargeButton">
1156
+ <li>
1157
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Dashboard</a>
1158
+ </li>
1159
+ <li>
1160
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Settings</a>
1161
+ </li>
1162
+ <li>
1163
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Earnings</a>
1164
+ </li>
1165
+ </ul>
1166
+ </div>
1167
+ </li>
1168
+ <li>
1169
+ <a href="#" class="block py-2 px-3 text-body rounded hover:bg-neutral-tertiary md:hover:bg-transparent md:border-0 md:hover:text-fg-brand md:p-0 md:dark:hover:bg-transparent">Services</a>
1170
+ </li>
1171
+ <li>
1172
+ <a href="#" class="block py-2 px-3 text-body rounded hover:bg-neutral-tertiary md:hover:bg-transparent md:border-0 md:hover:text-fg-brand md:p-0 md:dark:hover:bg-transparent">Pricing</a>
1173
+ </li>
1174
+ <li>
1175
+ <a href="#" class="block py-2 px-3 text-body rounded hover:bg-neutral-tertiary md:hover:bg-transparent md:border-0 md:hover:text-fg-brand md:p-0 md:dark:hover:bg-transparent">Contact</a>
1176
+ </li>
1177
+ </ul>
1178
+ </div>
1179
+ </div>
1180
+ </nav>
1181
+ {{< /example >}}
1182
+
1183
+ ## Dropdown datepicker
1184
+
1185
+ Use this example to show a date range picker inside a dropdown menu. Use the `data-dropdown-ignore-click-outside-class={class}` option to keep the dropdown menu open when interacting with the datepicker component by setting the element's parent class name.
1186
+
1187
+ {{< example class="flex justify-center" github="components/dropdowns.md" show_dark=true iframeHeight="520" >}}
1188
+ <button id="dateRangeButton" data-dropdown-toggle="dateRangeDropdown" data-dropdown-ignore-click-outside-class="datepicker" type="button" class="inline-flex items-center text-fg-brand font-medium hover:underline">
1189
+ 31 Nov <p class="ms-1"> - 31 Dev </p>
1190
+ <svg class="w-5 h-5 ms-1.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m19 9-7 7-7-7"/></svg>
1191
+ </button>
1192
+
1193
+ <div id="dateRangeDropdown" class="z-10 hidden bg-neutral-primary-soft border border-default rounded-base shadow-sm w-96">
1194
+ <div class="p-3" aria-labelledby="dateRangeButton">
1195
+ <div id="date-range-picker" date-rangepicker class="flex items-center">
1196
+ <div class="relative">
1197
+ <div class="absolute inset-y-0 start-0 flex items-center ps-3 pointer-events-none">
1198
+ <svg class="w-4 h-4 text-body" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 10h16m-8-3V4M7 7V4m10 3V4M5 20h14a1 1 0 0 0 1-1V7a1 1 0 0 0-1-1H5a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1Zm3-7h.01v.01H8V13Zm4 0h.01v.01H12V13Zm4 0h.01v.01H16V13Zm-8 4h.01v.01H8V17Zm4 0h.01v.01H12V17Zm4 0h.01v.01H16V17Z"/></svg>
1199
+ </div>
1200
+ <input id="datepicker-range-start" name="start" type="text" class="block w-full ps-9 pe-3 py-2.5 bg-neutral-secondary-medium border border-default-medium text-heading text-sm rounded-base focus:ring-brand focus:border-brand px-3 py-2.5 shadow-xs placeholder:text-body" placeholder="Date start">
1201
+ </div>
1202
+ <span class="mx-4 text-body">to</span>
1203
+ <div class="relative">
1204
+ <div class="absolute inset-y-0 start-0 flex items-center ps-3 pointer-events-none">
1205
+ <svg class="w-4 h-4 text-body" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 10h16m-8-3V4M7 7V4m10 3V4M5 20h14a1 1 0 0 0 1-1V7a1 1 0 0 0-1-1H5a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1Zm3-7h.01v.01H8V13Zm4 0h.01v.01H12V13Zm4 0h.01v.01H16V13Zm-8 4h.01v.01H8V17Zm4 0h.01v.01H12V17Zm4 0h.01v.01H16V17Z"/></svg>
1206
+ </div>
1207
+ <input id="datepicker-range-end" name="end" type="text" class="block w-full ps-9 pe-3 py-2.5 bg-neutral-secondary-medium border border-default-medium text-heading text-sm rounded-base focus:ring-brand focus:border-brand px-3 py-2.5 shadow-xs placeholder:text-body" placeholder="Date end">
1208
+ </div>
1209
+ </div>
1210
+ </div>
1211
+ </div>
1212
+ {{< /example >}}
1213
+
1214
+ ## Sizes
1215
+
1216
+ The dropdown menus work with buttons of all sizes including smaller or larger ones.
1217
+
1218
+ {{< example github="components/dropdowns.md" class="space-x-2 space-y-2" show_dark=true iframeHeight="380" >}}
1219
+ <button id="dropdownSmallButton" data-dropdown-toggle="dropdownSmall" class="inline-flex items-center text-white bg-brand box-border border border-transparent hover:bg-brand-strong focus:ring-4 focus:ring-brand-medium shadow-xs font-medium leading-5 rounded-base text-sm px-4 py-2.5 focus:outline-none" type="button">
1220
+ Small dropdown
1221
+ <svg class="w-4 h-4 ms-1.5 -me-0.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m19 9-7 7-7-7"/></svg>
1222
+ </button>
1223
+
1224
+ <!-- Dropdown menu -->
1225
+ <div id="dropdownSmall" class="z-10 hidden bg-neutral-primary-medium border border-default-medium rounded-base shadow-lg w-44">
1226
+ <ul class="p-2 text-sm text-body font-medium" aria-labelledby="dropdownSmallButton">
1227
+ <li>
1228
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Dashboard</a>
1229
+ </li>
1230
+ <li>
1231
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Settings</a>
1232
+ </li>
1233
+ <li>
1234
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Earnings</a>
1235
+ </li>
1236
+ <li>
1237
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Sign out</a>
1238
+ </li>
1239
+ </ul>
1240
+ </div>
1241
+
1242
+ <button id="dropdownLargeButton" data-dropdown-toggle="dropdownLarge" class="inline-flex items-center text-white bg-brand hover:bg-brand-strong box-border border border-transparent focus:ring-4 focus:ring-brand-medium shadow-xs font-medium rounded-base text-base px-5 py-3 focus:outline-none" type="button">
1243
+ Large dropdown
1244
+ <svg class="w-4 h-4 ms-1.5 -me-0.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m19 9-7 7-7-7"/></svg>
1245
+ </button>
1246
+
1247
+ <!-- Dropdown menu -->
1248
+ <div id="dropdownLarge" class="z-10 hidden bg-neutral-primary-medium border border-default-medium rounded-base shadow-lg w-44">
1249
+ <ul class="p-2 text-sm text-body font-medium" aria-labelledby="dropdownLargeButton">
1250
+ <li>
1251
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Dashboard</a>
1252
+ </li>
1253
+ <li>
1254
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Settings</a>
1255
+ </li>
1256
+ <li>
1257
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Earnings</a>
1258
+ </li>
1259
+ <li>
1260
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Sign out</a>
1261
+ </li>
1262
+ </ul>
1263
+ </div>
1264
+ {{< /example >}}
1265
+
1266
+ ## Placement
1267
+
1268
+ You can also use the `data-dropdown-placement={top|right|bottom|left}` data attribute options to choose the placement of the dropdown menu. By default the positioning is set to the bottom side of the button.
1269
+
1270
+ {{< example class="flex flex-wrap space-x-4 justify-center py-48" github="components/dropdowns.md" show_dark=true >}}
1271
+ <button id="dropdownTopButton" data-dropdown-toggle="dropdownTop" data-dropdown-placement="top" class="inline-flex items-center text-white bg-brand box-border border border-transparent hover:bg-brand-strong focus:ring-4 focus:ring-brand-medium shadow-xs font-medium leading-5 rounded-base text-sm px-4 py-2.5 focus:outline-none" type="button">
1272
+ Dropdown top
1273
+ <svg class="w-4 h-4 ms-1.5 -me-0.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m5 15 7-7 7 7"/></svg>
1274
+ </button>
1275
+
1276
+ <!-- Dropdown menu -->
1277
+ <div id="dropdownTop" class="z-10 hidden bg-neutral-primary-medium border border-default-medium rounded-base shadow-lg w-44">
1278
+ <ul class="p-2 text-sm text-body font-medium" aria-labelledby="dropdownTopButton">
1279
+ <li>
1280
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Dashboard</a>
1281
+ </li>
1282
+ <li>
1283
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Settings</a>
1284
+ </li>
1285
+ <li>
1286
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Earnings</a>
1287
+ </li>
1288
+ <li>
1289
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Sign out</a>
1290
+ </li>
1291
+ </ul>
1292
+ </div>
1293
+
1294
+ <button id="dropdownRightButton" data-dropdown-toggle="dropdownRight" data-dropdown-placement="right" class="inline-flex items-center text-white bg-brand box-border border border-transparent hover:bg-brand-strong focus:ring-4 focus:ring-brand-medium shadow-xs font-medium leading-5 rounded-base text-sm px-4 py-2.5 focus:outline-none" type="button">
1295
+ Dropdown right
1296
+ <svg class="w-4 h-4 ms-1.5 -me-0.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m9 5 7 7-7 7"/></svg>
1297
+ </button>
1298
+
1299
+ <!-- Dropdown menu -->
1300
+ <div id="dropdownRight" class="z-10 hidden bg-neutral-primary-medium border border-default-medium rounded-base shadow-lg w-44">
1301
+ <ul class="p-2 text-sm text-body font-medium" aria-labelledby="dropdownRightButton">
1302
+ <li>
1303
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Dashboard</a>
1304
+ </li>
1305
+ <li>
1306
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Settings</a>
1307
+ </li>
1308
+ <li>
1309
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Earnings</a>
1310
+ </li>
1311
+ <li>
1312
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Sign out</a>
1313
+ </li>
1314
+ </ul>
1315
+ </div>
1316
+
1317
+ <button id="dropdownBottomButton" data-dropdown-toggle="dropdownBottom" data-dropdown-placement="bottom" class="inline-flex items-center text-white bg-brand box-border border border-transparent hover:bg-brand-strong focus:ring-4 focus:ring-brand-medium shadow-xs font-medium leading-5 rounded-base text-sm px-4 py-2.5 focus:outline-none" type="button">
1318
+ Dropdown bottom
1319
+ <svg class="w-4 h-4 ms-1.5 -me-0.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m19 9-7 7-7-7"/></svg>
1320
+ </button>
1321
+
1322
+ <!-- Dropdown menu -->
1323
+ <div id="dropdownBottom" class="z-10 hidden bg-neutral-primary-medium border border-default-medium rounded-base shadow-lg w-44">
1324
+ <ul class="p-2 text-sm text-body font-medium" aria-labelledby="dropdownBottomButton">
1325
+ <li>
1326
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Dashboard</a>
1327
+ </li>
1328
+ <li>
1329
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Settings</a>
1330
+ </li>
1331
+ <li>
1332
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Earnings</a>
1333
+ </li>
1334
+ <li>
1335
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Sign out</a>
1336
+ </li>
1337
+ </ul>
1338
+ </div>
1339
+
1340
+ <button id="dropdownLeftButton" data-dropdown-toggle="dropdownLeft" data-dropdown-placement="left" class="inline-flex items-center text-white bg-brand box-border border border-transparent hover:bg-brand-strong focus:ring-4 focus:ring-brand-medium shadow-xs font-medium leading-5 rounded-base text-sm px-4 py-2.5 focus:outline-none" type="button">
1341
+ <svg class="w-4 h-4 me-1.5 -ms-0.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m15 19-7-7 7-7"/></svg>
1342
+ Dropdown left
1343
+ </button>
1344
+
1345
+ <!-- Dropdown menu -->
1346
+ <div id="dropdownLeft" class="z-10 hidden bg-neutral-primary-medium border border-default-medium rounded-base shadow-lg w-44">
1347
+ <ul class="p-2 text-sm text-body font-medium" aria-labelledby="dropdownLeftButton">
1348
+ <li>
1349
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Dashboard</a>
1350
+ </li>
1351
+ <li>
1352
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Settings</a>
1353
+ </li>
1354
+ <li>
1355
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Earnings</a>
1356
+ </li>
1357
+ <li>
1358
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Sign out</a>
1359
+ </li>
1360
+ </ul>
1361
+ </div>
1362
+ {{< /example >}}
1363
+
1364
+ ### Double placement
1365
+
1366
+ You can combine the placement options by using the `top|right|bottom|left-{start|end}` values. For example, `left-end` will position the dropdown on the left bottom, whereas `right-end` will position it on the right bottom side.
1367
+
1368
+ {{< example class="flex flex-wrap justify-center space-x-4" github="components/dropdowns.md" iframeHeight="240" show_dark=true >}}
1369
+ <button id="dropdownLeftEndButton" data-dropdown-toggle="dropdownLeftEnd" data-dropdown-placement="left-end" class="inline-flex items-center text-white bg-brand box-border border border-transparent hover:bg-brand-strong focus:ring-4 focus:ring-brand-medium shadow-xs font-medium leading-5 rounded-base text-sm px-4 py-2.5 focus:outline-none" type="button">
1370
+ <svg class="w-4 h-4 me-1.5 -ms-0.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m15 19-7-7 7-7"/></svg>
1371
+ Dropdown left end
1372
+ </button>
1373
+
1374
+ <!-- Dropdown menu -->
1375
+ <div id="dropdownLeftEnd" class="z-20 hidden bg-neutral-primary-medium border border-default-medium rounded-base shadow-lg w-44">
1376
+ <ul class="p-2 text-sm text-body font-medium" aria-labelledby="dropdownLeftEndButton">
1377
+ <li>
1378
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Dashboard</a>
1379
+ </li>
1380
+ <li>
1381
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Settings</a>
1382
+ </li>
1383
+ <li>
1384
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Earnings</a>
1385
+ </li>
1386
+ <li>
1387
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Sign out</a>
1388
+ </li>
1389
+ </ul>
1390
+ </div>
1391
+
1392
+ <button id="dropdownRightEndButton" data-dropdown-toggle="dropdownRightEnd" data-dropdown-placement="right-end" class="inline-flex items-center text-white bg-brand box-border border border-transparent hover:bg-brand-strong focus:ring-4 focus:ring-brand-medium shadow-xs font-medium leading-5 rounded-base text-sm px-4 py-2.5 focus:outline-none" type="button">
1393
+ Dropdown right end
1394
+ <svg class="w-4 h-4 ms-1.5 -me-0.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m9 5 7 7-7 7"/></svg>
1395
+ </button>
1396
+
1397
+ <!-- Dropdown menu -->
1398
+ <div id="dropdownRightEnd" class="z-10 hidden bg-neutral-primary-medium border border-default-medium rounded-base shadow-lg w-44">
1399
+ <ul class="p-2 text-sm text-body font-medium" aria-labelledby="dropdownRightEndButton">
1400
+ <li>
1401
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Dashboard</a>
1402
+ </li>
1403
+ <li>
1404
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Settings</a>
1405
+ </li>
1406
+ <li>
1407
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Earnings</a>
1408
+ </li>
1409
+ <li>
1410
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Sign out</a>
1411
+ </li>
1412
+ </ul>
1413
+ </div>
1414
+ {{< /example >}}
1415
+
1416
+ ## Dropdown offset
1417
+
1418
+ Use the offset options on the dropdown component to set the distance and skidding of the menu relative to the trigger element.
1419
+
1420
+ ### Distance
1421
+
1422
+ Use the `data-dropdown-offset-distance={pixels}` data attribute to set the number of pixels you want the dropdown menu to be offset from the trigger element.
1423
+
1424
+ {{< example class="flex flex-wrap justify-center" github="components/dropdowns.md" iframeHeight="320" show_dark=true >}}
1425
+ <button id="dropdownOffsetButton" data-dropdown-toggle="dropdownDistance" data-dropdown-offset-distance="35" data-dropdown-offset-skidding="0" class="inline-flex items-center text-white bg-brand box-border border border-transparent hover:bg-brand-strong focus:ring-4 focus:ring-brand-medium shadow-xs font-medium leading-5 rounded-base text-sm px-4 py-2.5 focus:outline-none" type="button">
1426
+ Dropdown button
1427
+ <svg class="w-4 h-4 ms-1.5 -me-0.5 rtl:rotate-180" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m9 5 7 7-7 7"/></svg>
1428
+ </button>
1429
+
1430
+ <!-- Dropdown menu -->
1431
+ <div id="dropdownDistance" class="z-10 hidden bg-neutral-primary-medium border border-default-medium rounded-base shadow-lg w-44">
1432
+ <ul class="p-2 text-sm text-body font-medium" aria-labelledby="dropdownDefault">
1433
+ <li>
1434
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Dashboard</a>
1435
+ </li>
1436
+ <li>
1437
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Settings</a>
1438
+ </li>
1439
+ <li>
1440
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Earnings</a>
1441
+ </li>
1442
+ <li>
1443
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Sign out</a>
1444
+ </li>
1445
+ </ul>
1446
+ </div>
1447
+ {{< /example >}}
1448
+
1449
+ ### Skidding
1450
+
1451
+ The `data-dropdown-offset-skidding={pixels}` data attribute can be used to move up or down (or left and right) the dropdown menu along and relative to the trigger element.
1452
+
1453
+ {{< example class="flex flex-wrap justify-center" github="components/dropdowns.md" iframeHeight="320" show_dark=true >}}
1454
+ <button id="dropdownOffsetButton" data-dropdown-toggle="dropdownSkidding" data-dropdown-offset-distance="10" data-dropdown-offset-skidding="100" data-dropdown-placement="right" class="inline-flex items-center text-white bg-brand box-border border border-transparent hover:bg-brand-strong focus:ring-4 focus:ring-brand-medium shadow-xs font-medium leading-5 rounded-base text-sm px-4 py-2.5 focus:outline-none" type="button">
1455
+ Dropdown button
1456
+ <svg class="w-4 h-4 ms-1.5 -me-0.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m19 9-7 7-7-7"/></svg>
1457
+ </button>
1458
+
1459
+ <!-- Dropdown menu -->
1460
+ <div id="dropdownSkidding" class="z-10 hidden bg-neutral-primary-medium border border-default-medium rounded-base shadow-lg w-44">
1461
+ <ul class="p-2 text-sm text-body font-medium" aria-labelledby="dropdownDefault">
1462
+ <li>
1463
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Dashboard</a>
1464
+ </li>
1465
+ <li>
1466
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Settings</a>
1467
+ </li>
1468
+ <li>
1469
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Earnings</a>
1470
+ </li>
1471
+ <li>
1472
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Sign out</a>
1473
+ </li>
1474
+ </ul>
1475
+ </div>
1476
+ {{< /example >}}
1477
+
1478
+ ## More examples
1479
+
1480
+ For more dropdown examples you can check out the [dropdown filter](https://flowbite.com/blocks/application/filter/) components from Flowbite Blocks.
1481
+
1482
+ ## JavaScript behaviour
1483
+
1484
+ The **Dropdown** class from Flowbite can be used to create an object that will show a dropdown menu relative to the main trigger element (eg. a button) based on the parameters, options, and methods that you provide.
1485
+
1486
+ ### Object parameters
1487
+
1488
+ Initialize a Dropdown object with the object parameters such as the main target dropdown menu, a trigger element (eg. a button) and options to set the placement relative to the trigger element.
1489
+
1490
+ <div class="relative my-10 overflow-x-auto shadow-xs rounded-base border border-default">
1491
+ <table class="w-full text-sm text-left text-body">
1492
+ <thead class="bg-neutral-secondary-soft text-heading">
1493
+ <tr class="text-xs font-medium uppercase">
1494
+ <th scope="col" class="px-6 py-3">
1495
+ Parameter
1496
+ </th>
1497
+ <th scope="col" class="px-6 py-3">
1498
+ Type
1499
+ </th>
1500
+ <th scope="col" class="px-6 py-3">
1501
+ Required
1502
+ </th>
1503
+ <th scope="col" class="px-6 py-3">
1504
+ Description
1505
+ </th>
1506
+ </tr>
1507
+ </thead>
1508
+ <tbody>
1509
+ <tr class="border-b bg-neutral-primary border-default">
1510
+ <td class="px-6 py-4 font-medium">
1511
+ <code class="text-fg-brand">targetElement</code>
1512
+ </td>
1513
+ <td class="px-6 py-4">
1514
+ Element
1515
+ </td>
1516
+ <td class="px-6 py-4">
1517
+ Required
1518
+ </td>
1519
+ <td class="px-6 py-4">
1520
+ Apply the main dropdown menu element as the first parameter of the Dropdown object.
1521
+ </td>
1522
+ </tr>
1523
+ <tr class="border-b bg-neutral-primary border-default">
1524
+ <td class="px-6 py-4 font-medium">
1525
+ <code class="text-fg-brand">triggerElement</code>
1526
+ </td>
1527
+ <td class="px-6 py-4">
1528
+ Element
1529
+ </td>
1530
+ <td class="px-6 py-4">
1531
+ Required
1532
+ </td>
1533
+ <td class="px-6 py-4">
1534
+ Apply the trigger element, such as a button, which is required to position the dropdown menu and set a click event.
1535
+ </td>
1536
+ </tr>
1537
+ <tr class="border-b bg-neutral-primary border-default">
1538
+ <td class="px-6 py-4 font-medium">
1539
+ <code class="text-fg-brand">options</code>
1540
+ </td>
1541
+ <td class="px-6 py-4">
1542
+ Object
1543
+ </td>
1544
+ <td class="px-6 py-4">
1545
+ Optional
1546
+ </td>
1547
+ <td class="px-6 py-4">
1548
+ Use the options parameter to set the positioning of the dropdown menu.
1549
+ </td>
1550
+ </tr>
1551
+ <tr class="bg-neutral-primary">
1552
+ <td class="px-6 py-4 font-medium">
1553
+ <code class="text-fg-brand">instanceOptions</code>
1554
+ </td>
1555
+ <td class="px-6 py-4">
1556
+ Object
1557
+ </td>
1558
+ <td class="px-6 py-4">
1559
+ Optional
1560
+ </td>
1561
+ <td class="px-6 py-4">
1562
+ Object of options that allows you to set a custom ID for the instance that is being added to the <a href="https://flowbite.com/docs/getting-started/javascript/#instance-options" class="underline hover:no-underline">Instance Manager</a> and whether to override or not an existing instance.
1563
+ </td>
1564
+ </tr>
1565
+ </tbody>
1566
+ </table>
1567
+ </div>
1568
+
1569
+ ### Options
1570
+
1571
+ Use the following options as the third parameter for the Dropdown class to set the placement of the dropdown menu.
1572
+
1573
+ <div class="relative my-10 overflow-x-auto shadow-xs rounded-base border border-default">
1574
+ <table class="w-full text-sm text-left text-body">
1575
+ <thead class="bg-neutral-secondary-soft text-heading">
1576
+ <tr class="text-xs font-medium uppercase">
1577
+ <th scope="col" class="px-6 py-3">
1578
+ Option
1579
+ </th>
1580
+ <th scope="col" class="px-6 py-3">
1581
+ Type
1582
+ </th>
1583
+ <th scope="col" class="px-6 py-3">
1584
+ Description
1585
+ </th>
1586
+ </tr>
1587
+ </thead>
1588
+ <tbody>
1589
+ <tr class="border-b bg-neutral-primary border-default">
1590
+ <td class="px-6 py-4 font-medium">
1591
+ <code class="text-fg-brand">placement</code>
1592
+ </td>
1593
+ <td class="px-6 py-4 font-medium">
1594
+ String
1595
+ </td>
1596
+ <td class="px-6 py-4">
1597
+ Set the position of the dropdown menu relative to the trigger element choosing from <code class="text-fg-brand">top|right|bottom|left</code>.
1598
+ </td>
1599
+ </tr>
1600
+ <tr class="border-b bg-neutral-primary border-default">
1601
+ <td class="px-6 py-4 font-medium">
1602
+ <code class="text-fg-brand">triggerType</code>
1603
+ </td>
1604
+ <td class="px-6 py-4 font-medium">
1605
+ String
1606
+ </td>
1607
+ <td class="px-6 py-4">
1608
+ Set the event type that will trigger the dropdown menu choosing between <code class="text-fg-brand">hover|click|none</code>.
1609
+ </td>
1610
+ </tr>
1611
+ <tr class="border-b bg-neutral-primary border-default">
1612
+ <td class="px-6 py-4 font-medium">
1613
+ <code class="text-fg-brand">offsetDistance</code>
1614
+ </td>
1615
+ <td class="px-6 py-4 font-medium">
1616
+ String
1617
+ </td>
1618
+ <td class="px-6 py-4">
1619
+ Set the amount of pixels the dropdown menu should be offset relative to the trigger element on the X horizontal axis.
1620
+ </td>
1621
+ </tr>
1622
+ <tr class="border-b bg-neutral-primary border-default">
1623
+ <td class="px-6 py-4 font-medium">
1624
+ <code class="text-fg-brand">offsetSkidding</code>
1625
+ </td>
1626
+ <td class="px-6 py-4 font-medium">
1627
+ String
1628
+ </td>
1629
+ <td class="px-6 py-4">
1630
+ Set the number of pixels the dropdown menu should be offset relative to the trigger element on the Y horizontal axis.
1631
+ </td>
1632
+ </tr>
1633
+ <tr class="border-b bg-neutral-primary border-default">
1634
+ <td class="px-6 py-4 font-medium">
1635
+ <code class="text-fg-brand">delay</code>
1636
+ </td>
1637
+ <td class="px-6 py-4 font-medium">
1638
+ Number
1639
+ </td>
1640
+ <td class="px-6 py-4">
1641
+ Set the milliseconds for which the showing or hiding of the dropdown will be delayed for when using the hover trigger type.
1642
+ </td>
1643
+ </tr>
1644
+ <tr class="border-b bg-neutral-primary border-default">
1645
+ <td class="px-6 py-4 font-medium">
1646
+ <code class="text-fg-brand">ignoreClickOutsideClass</code>
1647
+ </td>
1648
+ <td class="px-6 py-4 font-medium">
1649
+ String
1650
+ </td>
1651
+ <td class="px-6 py-4">
1652
+ Set a class for one or more elements that when they are clicked should ignore closing the dropdown (ie. offcanvas datepicker).
1653
+ </td>
1654
+ </tr>
1655
+ <tr class="border-b bg-neutral-primary border-default">
1656
+ <td class="px-6 py-4 font-medium">
1657
+ <code class="text-fg-brand">onHide</code>
1658
+ </td>
1659
+ <td class="px-6 py-4 font-medium">
1660
+ Function
1661
+ </td>
1662
+ <td class="px-6 py-4">
1663
+ Set a callback function when the dropdown has been hidden.
1664
+ </td>
1665
+ </tr>
1666
+ <tr class="border-b bg-neutral-primary border-default">
1667
+ <td class="px-6 py-4 font-medium">
1668
+ <code class="text-fg-brand">onShow</code>
1669
+ </td>
1670
+ <td class="px-6 py-4 font-medium">
1671
+ Function
1672
+ </td>
1673
+ <td class="px-6 py-4">
1674
+ Set a callback function when the dropdown has been shown.
1675
+ </td>
1676
+ </tr>
1677
+ <tr class="bg-neutral-primary">
1678
+ <td class="px-6 py-4 font-medium">
1679
+ <code class="text-fg-brand">onToggle</code>
1680
+ </td>
1681
+ <td class="px-6 py-4 font-medium">
1682
+ Function
1683
+ </td>
1684
+ <td class="px-6 py-4">
1685
+ Set a callback function when the dropdown visibility has been toggled.
1686
+ </td>
1687
+ </tr>
1688
+ </tbody>
1689
+ </table>
1690
+ </div>
1691
+
1692
+ ### Methods
1693
+
1694
+ Use the methods from the Dropdown object to programmatically show or hide the dropdown menu directly from JavaScript.
1695
+
1696
+ <div class="relative my-10 overflow-x-auto shadow-xs rounded-base border border-default">
1697
+ <table class="w-full text-sm text-left text-body">
1698
+ <thead class="bg-neutral-secondary-soft text-heading">
1699
+ <tr class="text-xs font-medium uppercase">
1700
+ <th scope="col" class="px-6 py-3">
1701
+ Method
1702
+ </th>
1703
+ <th scope="col" class="px-6 py-3">
1704
+ Description
1705
+ </th>
1706
+ </tr>
1707
+ </thead>
1708
+ <tbody>
1709
+ <tr class="border-b bg-neutral-primary border-default">
1710
+ <td class="px-6 py-4 font-medium">
1711
+ <code class="text-fg-brand">show()</code>
1712
+ </td>
1713
+ <td class="px-6 py-4">
1714
+ Use this method on the Dropdown object to show the dropdown menu.
1715
+ </td>
1716
+ </tr>
1717
+ <tr class="border-b bg-neutral-primary border-default">
1718
+ <td class="px-6 py-4 font-medium">
1719
+ <code class="text-fg-brand">hide()</code>
1720
+ </td>
1721
+ <td class="px-6 py-4">
1722
+ Use this method on the Dropdown object to hide the dropdown menu.
1723
+ </td>
1724
+ </tr>
1725
+ <tr class="border-b bg-neutral-primary border-default">
1726
+ <td class="px-6 py-4 font-medium">
1727
+ <code class="text-fg-brand">toggle()</code>
1728
+ </td>
1729
+ <td class="px-6 py-4">
1730
+ Use this method on the Dropdown object to toggle the visibility of the dropdown menu.
1731
+ </td>
1732
+ </tr>
1733
+ <tr class="border-b bg-neutral-primary border-default">
1734
+ <td class="px-6 py-4 font-medium">
1735
+ <code class="text-fg-brand">isVisible()</code>
1736
+ </td>
1737
+ <td class="px-6 py-4">
1738
+ Returns true or false based on the visibility of the dropdown.
1739
+ </td>
1740
+ </tr>
1741
+ <tr class="border-b bg-neutral-primary border-default">
1742
+ <td class="px-6 py-4 font-medium">
1743
+ <code class="text-fg-brand">updateOnShow(callback)</code>
1744
+ </td>
1745
+ <td class="px-6 py-4">
1746
+ Use this method to set a callback function when the dropdown has been shown.
1747
+ </td>
1748
+ </tr>
1749
+ <tr class="border-b bg-neutral-primary border-default">
1750
+ <td class="px-6 py-4 font-medium">
1751
+ <code class="text-fg-brand">updateOnHide(callback)</code>
1752
+ </td>
1753
+ <td class="px-6 py-4">
1754
+ Use this method to set a callback function when the dropdown has been hidden.
1755
+ </td>
1756
+ </tr>
1757
+ <tr class="bg-neutral-primary">
1758
+ <td class="px-6 py-4 font-medium">
1759
+ <code class="text-fg-brand">updateOnToggle(callback)</code>
1760
+ </td>
1761
+ <td class="px-6 py-4">
1762
+ Use this method to set a callback function when the dropdown visibility has been changed.
1763
+ </td>
1764
+ </tr>
1765
+ </tbody>
1766
+ </table>
1767
+ </div>
1768
+
1769
+ ### Example
1770
+
1771
+ Check out the following JavaScript example to learn how to initialize, set the options, and use the methods for the Dropdown object.
1772
+
1773
+ First of all, you need to set the main target element which will be the dropdown menu and the trigger element which will can be a button or a text.
1774
+
1775
+ After that, you can also optionally set an options object to set the placement of the dropdown menu and callback functions.
1776
+
1777
+ {{< code lang="javascript" file="dropdown.js" icon="file" >}}
1778
+ // set the dropdown menu element
1779
+ const $targetEl = document.getElementById('dropdownMenu');
1780
+
1781
+ // set the element that trigger the dropdown menu on click
1782
+ const $triggerEl = document.getElementById('dropdownButton');
1783
+
1784
+ // options with default values
1785
+ const options = {
1786
+ placement: 'bottom',
1787
+ triggerType: 'click',
1788
+ offsetSkidding: 0,
1789
+ offsetDistance: 10,
1790
+ delay: 300,
1791
+ ignoreClickOutsideClass: false,
1792
+ onHide: () => {
1793
+ console.log('dropdown has been hidden');
1794
+ },
1795
+ onShow: () => {
1796
+ console.log('dropdown has been shown');
1797
+ },
1798
+ onToggle: () => {
1799
+ console.log('dropdown has been toggled');
1800
+ },
1801
+ };
1802
+
1803
+ // instance options object
1804
+ const instanceOptions = {
1805
+ id: 'dropdownMenu',
1806
+ override: true
1807
+ };
1808
+ {{< /code >}}
1809
+
1810
+ Create a new Dropdown object based on the options above.
1811
+
1812
+ {{< code lang="javascript" file="dropdown.js" icon="file" >}}
1813
+ import { Dropdown } from 'flowbite';
1814
+
1815
+ /*
1816
+ * $targetEl: required
1817
+ * $triggerEl: required
1818
+ * options: optional
1819
+ * instanceOptions: optional
1820
+ */
1821
+ const dropdown = new Dropdown($targetEl, $triggerEl, options, instanceOptions);
1822
+ {{< /code >}}
1823
+
1824
+ Use the `show` and `hide` methods on the Dropdown object to programmatically show or hide the dropdown menu directly from JavaScript.
1825
+
1826
+ {{< code lang="javascript" file="dropdown.js" icon="file" >}}
1827
+ // show the dropdown menu
1828
+ dropdown.show();
1829
+
1830
+ // hide the dropdown menu
1831
+ dropdown.hide();
1832
+
1833
+ // toggle the dropdown menu
1834
+ dropdown.toggle();
1835
+
1836
+ // check if dropdown is visible/open
1837
+ dropdown.isVisible();
1838
+ {{< /code >}}
1839
+
1840
+ ### HTML Markup
1841
+
1842
+ Use the following HTML code for the JavaScript example above.
1843
+
1844
+ {{< code lang="html" file="dropdown.html" icon="file" >}}
1845
+ <button id="dropdownButton" data-dropdown-toggle="dropdown" class="text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-base text-sm px-5 py-2.5 text-center inline-flex items-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800" type="button">Dropdown button <svg class="w-2.5 h-2.5 ms-3" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 10 6">
1846
+ <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m1 1 4 4 4-4"/>
1847
+ </svg>
1848
+ </button>
1849
+
1850
+ <!-- Dropdown menu -->
1851
+ <div id="dropdownMenu" class="z-10 hidden bg-neutral-primary-medium border border-default-medium rounded-base shadow-lg w-44">
1852
+ <ul class="p-2 text-sm text-body font-medium" aria-labelledby="dropdownButton">
1853
+ <li>
1854
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Dashboard</a>
1855
+ </li>
1856
+ <li>
1857
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Settings</a>
1858
+ </li>
1859
+ <li>
1860
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Earnings</a>
1861
+ </li>
1862
+ <li>
1863
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Sign out</a>
1864
+ </li>
1865
+ </ul>
1866
+ </div>
1867
+ {{< /code >}}
1868
+
1869
+ ### TypeScript
1870
+
1871
+ If you're using the <a href="{{< ref "getting-started/typescript" >}}">TypeScript configuration</a> from Flowbite then you can import the types for the Dropdown class, parameters and its options.
1872
+
1873
+ Here's an example that applies the types from Flowbite to the code above:
1874
+
1875
+ {{< code lang="typescript" file="dropdown.ts" icon="file" >}}
1876
+ import { Dropdown } from 'flowbite';
1877
+ import type { DropdownOptions, DropdownInterface } from 'flowbite';
1878
+ import type { InstanceOptions } from 'flowbite';
1879
+
1880
+ // set the dropdown menu element
1881
+ const $targetEl: HTMLElement = document.getElementById('dropdownMenu');
1882
+
1883
+ // set the element that trigger the dropdown menu on click
1884
+ const $triggerEl: HTMLElement = document.getElementById('dropdownButton');
1885
+
1886
+ // options with default values
1887
+ const options: DropdownOptions = {
1888
+ placement: 'bottom',
1889
+ triggerType: 'click',
1890
+ offsetSkidding: 0,
1891
+ offsetDistance: 10,
1892
+ delay: 300,
1893
+ onHide: () => {
1894
+ console.log('dropdown has been hidden');
1895
+ },
1896
+ onShow: () => {
1897
+ console.log('dropdown has been shown');
1898
+ },
1899
+ onToggle: () => {
1900
+ console.log('dropdown has been toggled');
1901
+ },
1902
+ };
1903
+
1904
+ // instance options object
1905
+ const instanceOptions: InstanceOptions = {
1906
+ id: 'dropdownMenu',
1907
+ override: true
1908
+ };
1909
+
1910
+ /*
1911
+ * targetEl: required
1912
+ * triggerEl: required
1913
+ * options: optional
1914
+ * instanceOptions: optional
1915
+ */
1916
+ const dropdown: DropdownInterface = new Dropdown(
1917
+ $targetEl,
1918
+ $triggerEl,
1919
+ options,
1920
+ instanceOptions
1921
+ );
1922
+
1923
+ // show the dropdown
1924
+ dropdown.show();
1925
+ {{< /code >}}