flowbite-mcp 1.1.3 → 1.1.5
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.
- package/README.md +49 -74
- package/build/index.js +20 -36
- package/data/components/accordion.md +39 -53
- package/data/components/alerts.md +27 -44
- package/data/components/avatar.md +20 -33
- package/data/components/badge.md +34 -47
- package/data/components/banner.md +10 -29
- package/data/components/bottom-navigation.md +16 -29
- package/data/components/breadcrumb.md +12 -25
- package/data/components/button-group.md +26 -39
- package/data/components/buttons.md +41 -67
- package/data/components/card.md +34 -47
- package/data/components/carousel.md +25 -39
- package/data/components/chat-bubble.md +36 -50
- package/data/components/clipboard.md +256 -252
- package/data/components/datepicker.md +56 -70
- package/data/components/device-mockups.md +16 -29
- package/data/components/drawer.md +42 -56
- package/data/components/dropdowns.md +66 -80
- package/data/components/footer.md +16 -29
- package/data/components/forms.md +32 -50
- package/data/components/gallery.md +16 -33
- package/data/components/indicators.md +18 -31
- package/data/components/jumbotron.md +12 -25
- package/data/components/kbd.md +14 -27
- package/data/components/list-group.md +14 -27
- package/data/components/mega-menu.md +10 -24
- package/data/components/modal.md +37 -51
- package/data/components/navbar.md +41 -55
- package/data/components/pagination.md +22 -35
- package/data/components/popover.md +36 -51
- package/data/components/progress.md +10 -23
- package/data/components/qr-code.md +41 -133
- package/data/components/rating.md +16 -29
- package/data/components/sidebar.md +15 -30
- package/data/components/skeleton.md +16 -29
- package/data/components/speed-dial.md +40 -55
- package/data/components/spinner.md +14 -27
- package/data/components/stepper.md +14 -27
- package/data/components/tables.md +45 -64
- package/data/components/tabs.md +30 -45
- package/data/components/timeline.md +10 -23
- package/data/components/toast.md +25 -39
- package/data/components/tooltips.md +24 -39
- package/data/components/typography.md +22 -35
- package/data/components/video.md +14 -27
- package/data/forms/checkbox.md +27 -43
- package/data/forms/file-input.md +12 -26
- package/data/forms/floating-label.md +12 -25
- package/data/forms/input-field.md +17 -32
- package/data/forms/number-input.md +83 -93
- package/data/forms/phone-input.md +42 -54
- package/data/forms/radio.md +23 -39
- package/data/forms/range.md +12 -26
- package/data/forms/search-input.md +14 -31
- package/data/forms/select.md +15 -30
- package/data/forms/textarea.md +8 -21
- package/data/forms/timepicker.md +30 -42
- package/data/forms/toggle.md +18 -31
- package/data/plugins/charts.md +542 -526
- package/data/plugins/datatables.md +285 -286
- package/data/plugins/wysiwyg.md +658 -650
- package/data/quickstart.md +24 -24
- package/data/typography/blockquote.md +24 -37
- package/data/typography/headings.md +30 -43
- package/data/typography/hr.md +10 -23
- package/data/typography/images.md +32 -45
- package/data/typography/links.md +16 -29
- package/data/typography/lists.md +22 -35
- package/data/typography/paragraphs.md +30 -43
- package/data/typography/text.md +42 -55
- package/package.json +1 -1
|
@@ -1,20 +1,6 @@
|
|
|
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
1
|
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
2
|
|
|
17
|
-
Make sure to include
|
|
3
|
+
Make sure to include Flowbite's JavaScript file inside your project to enable dropdowns.
|
|
18
4
|
|
|
19
5
|
## Dropdown example
|
|
20
6
|
|
|
@@ -22,7 +8,7 @@ If you want to show a dropdown menu when clicking on an element make sure that y
|
|
|
22
8
|
|
|
23
9
|
The `dropdownId` is the id of the dropdown menu element.
|
|
24
10
|
|
|
25
|
-
|
|
11
|
+
```html
|
|
26
12
|
<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
13
|
Dropdown button
|
|
28
14
|
<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>
|
|
@@ -45,7 +31,7 @@ The `dropdownId` is the id of the dropdown menu element.
|
|
|
45
31
|
</li>
|
|
46
32
|
</ul>
|
|
47
33
|
</div>
|
|
48
|
-
|
|
34
|
+
```
|
|
49
35
|
|
|
50
36
|
## Dropdown hover
|
|
51
37
|
|
|
@@ -53,7 +39,7 @@ Use the `data-dropdown-trigger="{hover|click}"` data attribute options to set wh
|
|
|
53
39
|
|
|
54
40
|
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
41
|
|
|
56
|
-
|
|
42
|
+
```html
|
|
57
43
|
<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
44
|
Dropdown button
|
|
59
45
|
<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>
|
|
@@ -76,13 +62,13 @@ There's a 300ms default delay when showing or hiding the dropdown due to UI/UX r
|
|
|
76
62
|
</li>
|
|
77
63
|
</ul>
|
|
78
64
|
</div>
|
|
79
|
-
|
|
65
|
+
```
|
|
80
66
|
|
|
81
67
|
### Delay duration
|
|
82
68
|
|
|
83
69
|
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
70
|
|
|
85
|
-
|
|
71
|
+
```html
|
|
86
72
|
<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
73
|
Dropdown button
|
|
88
74
|
<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>
|
|
@@ -105,13 +91,13 @@ You can use the `data-dropdown-delay={milliseconds}` data attribute to set they
|
|
|
105
91
|
</li>
|
|
106
92
|
</ul>
|
|
107
93
|
</div>
|
|
108
|
-
|
|
94
|
+
```
|
|
109
95
|
|
|
110
96
|
## Dropdown divider
|
|
111
97
|
|
|
112
98
|
You can use the `divide-y divide-gray-100` classes to add separate elements inside the dropdown menu.
|
|
113
99
|
|
|
114
|
-
|
|
100
|
+
```html
|
|
115
101
|
<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
102
|
Dropdown button
|
|
117
103
|
<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>
|
|
@@ -134,13 +120,13 @@ You can use the `divide-y divide-gray-100` classes to add separate elements insi
|
|
|
134
120
|
<a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Separated link</a>
|
|
135
121
|
</div>
|
|
136
122
|
</div>
|
|
137
|
-
|
|
123
|
+
```
|
|
138
124
|
|
|
139
125
|
## Dropdown header
|
|
140
126
|
|
|
141
127
|
Use this example to show extra information outside of the list of menu items inside the dropdown.
|
|
142
128
|
|
|
143
|
-
|
|
129
|
+
```html
|
|
144
130
|
<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
131
|
Dropdown button
|
|
146
132
|
<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>
|
|
@@ -213,13 +199,13 @@ Use this example to show extra information outside of the list of menu items ins
|
|
|
213
199
|
</li>
|
|
214
200
|
</ul>
|
|
215
201
|
</div>
|
|
216
|
-
|
|
202
|
+
```
|
|
217
203
|
|
|
218
204
|
## Multi-level dropdown
|
|
219
205
|
|
|
220
206
|
Use this example to enable multi-level dropdown menus by adding stacked elements inside of each other.
|
|
221
207
|
|
|
222
|
-
|
|
208
|
+
```html
|
|
223
209
|
<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
210
|
Dropdown button
|
|
225
211
|
<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>
|
|
@@ -261,13 +247,13 @@ Use this example to enable multi-level dropdown menus by adding stacked elements
|
|
|
261
247
|
</li>
|
|
262
248
|
</ul>
|
|
263
249
|
</div>
|
|
264
|
-
|
|
250
|
+
```
|
|
265
251
|
|
|
266
252
|
## Dropdown with checkbox
|
|
267
253
|
|
|
268
254
|
Add multiple checkbox elements inside your dropdown menu to enable more advanced input interaction.
|
|
269
255
|
|
|
270
|
-
|
|
256
|
+
```html
|
|
271
257
|
<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
258
|
Dropdown button
|
|
273
259
|
<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>
|
|
@@ -295,13 +281,13 @@ Add multiple checkbox elements inside your dropdown menu to enable more advanced
|
|
|
295
281
|
</li>
|
|
296
282
|
</ul>
|
|
297
283
|
</div>
|
|
298
|
-
|
|
284
|
+
```
|
|
299
285
|
|
|
300
286
|
### Background hover
|
|
301
287
|
|
|
302
288
|
Use this example to update the background color of a menu item when using a list of checkbox elements.
|
|
303
289
|
|
|
304
|
-
|
|
290
|
+
```html
|
|
305
291
|
<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
292
|
Dropdown button
|
|
307
293
|
<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>
|
|
@@ -330,13 +316,13 @@ Use this example to update the background color of a menu item when using a list
|
|
|
330
316
|
</li>
|
|
331
317
|
</ul>
|
|
332
318
|
</div>
|
|
333
|
-
|
|
319
|
+
```
|
|
334
320
|
|
|
335
321
|
### Helper text
|
|
336
322
|
|
|
337
323
|
Add an extra helper text to each checkbox element inside the dropdown menu list with this example.
|
|
338
324
|
|
|
339
|
-
|
|
325
|
+
```html
|
|
340
326
|
<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
327
|
Dropdown button
|
|
342
328
|
<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>
|
|
@@ -385,13 +371,13 @@ Add an extra helper text to each checkbox element inside the dropdown menu list
|
|
|
385
371
|
</li>
|
|
386
372
|
</ul>
|
|
387
373
|
</div>
|
|
388
|
-
|
|
374
|
+
```
|
|
389
375
|
|
|
390
376
|
## Dropdown with radio
|
|
391
377
|
|
|
392
378
|
Enable more advanced interaction with your users by adding radio input elements inside the dropdown menu.
|
|
393
379
|
|
|
394
|
-
|
|
380
|
+
```html
|
|
395
381
|
<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
382
|
Dropdown radio
|
|
397
383
|
<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>
|
|
@@ -420,13 +406,13 @@ Enable more advanced interaction with your users by adding radio input elements
|
|
|
420
406
|
</li>
|
|
421
407
|
</ul>
|
|
422
408
|
</div>
|
|
423
|
-
|
|
409
|
+
```
|
|
424
410
|
|
|
425
411
|
### Background hover
|
|
426
412
|
|
|
427
413
|
Use this example to update the background color when hovering over a menu item when using radio elements.
|
|
428
414
|
|
|
429
|
-
|
|
415
|
+
```html
|
|
430
416
|
<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
417
|
Dropdown button
|
|
432
418
|
<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>
|
|
@@ -455,13 +441,13 @@ Use this example to update the background color when hovering over a menu item w
|
|
|
455
441
|
</li>
|
|
456
442
|
</ul>
|
|
457
443
|
</div>
|
|
458
|
-
|
|
444
|
+
```
|
|
459
445
|
|
|
460
446
|
### Helper text
|
|
461
447
|
|
|
462
448
|
This example can be used to add an extra helper text inside of each radio element from the dropdown menu.
|
|
463
449
|
|
|
464
|
-
|
|
450
|
+
```html
|
|
465
451
|
|
|
466
452
|
<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
453
|
Dropdown button
|
|
@@ -512,13 +498,13 @@ This example can be used to add an extra helper text inside of each radio elemen
|
|
|
512
498
|
</li>
|
|
513
499
|
</ul>
|
|
514
500
|
</div>
|
|
515
|
-
|
|
501
|
+
```
|
|
516
502
|
|
|
517
503
|
## Dropdown with toggle switch
|
|
518
504
|
|
|
519
505
|
Show a list of toggle switch elements inside the dropdown menu to enable a yes or no type of choice.
|
|
520
506
|
|
|
521
|
-
|
|
507
|
+
```html
|
|
522
508
|
<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
509
|
Dropdown button
|
|
524
510
|
<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>
|
|
@@ -557,13 +543,13 @@ Show a list of toggle switch elements inside the dropdown menu to enable a yes o
|
|
|
557
543
|
</ul>
|
|
558
544
|
</div>
|
|
559
545
|
|
|
560
|
-
|
|
546
|
+
```
|
|
561
547
|
|
|
562
548
|
## Dropdown with scrolling
|
|
563
549
|
|
|
564
550
|
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
551
|
|
|
566
|
-
|
|
552
|
+
```html
|
|
567
553
|
<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
554
|
Dropdown button
|
|
569
555
|
<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>
|
|
@@ -628,13 +614,13 @@ This example can be used when you want to show a long list of items that won't a
|
|
|
628
614
|
</button>
|
|
629
615
|
</div>
|
|
630
616
|
</div>
|
|
631
|
-
|
|
617
|
+
```
|
|
632
618
|
|
|
633
619
|
## Scrollable checkboxes
|
|
634
620
|
|
|
635
621
|
Use this example to show multiple dropdown items in a scrollable container with checkboxes.
|
|
636
622
|
|
|
637
|
-
|
|
623
|
+
```html
|
|
638
624
|
<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
625
|
Dropdown button
|
|
640
626
|
<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>
|
|
@@ -723,13 +709,13 @@ Use this example to show multiple dropdown items in a scrollable container with
|
|
|
723
709
|
</button>
|
|
724
710
|
</div>
|
|
725
711
|
</div>
|
|
726
|
-
|
|
712
|
+
```
|
|
727
713
|
|
|
728
714
|
## Dropdown with search
|
|
729
715
|
|
|
730
716
|
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
717
|
|
|
732
|
-
|
|
718
|
+
```html
|
|
733
719
|
<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
720
|
Dropdown button
|
|
735
721
|
<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>
|
|
@@ -822,13 +808,13 @@ Use this example if you want to add a search bar inside the dropdown menu to be
|
|
|
822
808
|
</button>
|
|
823
809
|
</div>
|
|
824
810
|
</div>
|
|
825
|
-
|
|
811
|
+
```
|
|
826
812
|
|
|
827
813
|
## Menu icon
|
|
828
814
|
|
|
829
815
|
Use the menu icon trigger element on components such as cards as an alternative element to the button.
|
|
830
816
|
|
|
831
|
-
|
|
817
|
+
```html
|
|
832
818
|
<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
819
|
<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
820
|
</button>
|
|
@@ -872,13 +858,13 @@ Use the menu icon trigger element on components such as cards as an alternative
|
|
|
872
858
|
<a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Separated link</a>
|
|
873
859
|
</div>
|
|
874
860
|
</div>
|
|
875
|
-
|
|
861
|
+
```
|
|
876
862
|
|
|
877
863
|
## Notification bell
|
|
878
864
|
|
|
879
865
|
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
866
|
|
|
881
|
-
|
|
867
|
+
```html
|
|
882
868
|
|
|
883
869
|
<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
870
|
<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>
|
|
@@ -960,13 +946,13 @@ Use this example to show a list of notifications inside your application by prov
|
|
|
960
946
|
</div>
|
|
961
947
|
</a>
|
|
962
948
|
</div>
|
|
963
|
-
|
|
949
|
+
```
|
|
964
950
|
|
|
965
951
|
## User avatar
|
|
966
952
|
|
|
967
953
|
This example can be used to show a list of menu items and options when a user is logged into your application.
|
|
968
954
|
|
|
969
|
-
|
|
955
|
+
```html
|
|
970
956
|
<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
957
|
<span class="sr-only">Open user menu</span>
|
|
972
958
|
<img class="w-8 h-8 rounded-full" src="/docs/images/people/profile-picture-5.jpg" alt="user photo">
|
|
@@ -1040,13 +1026,13 @@ This example can be used to show a list of menu items and options when a user is
|
|
|
1040
1026
|
</li>
|
|
1041
1027
|
</ul>
|
|
1042
1028
|
</div>
|
|
1043
|
-
|
|
1029
|
+
```
|
|
1044
1030
|
|
|
1045
1031
|
### Avatar with name
|
|
1046
1032
|
|
|
1047
1033
|
Use this example to also show the name or email of the user next to the avatar for the dropdown menu.
|
|
1048
1034
|
|
|
1049
|
-
|
|
1035
|
+
```html
|
|
1050
1036
|
<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
1037
|
<span class="sr-only">Open user menu</span>
|
|
1052
1038
|
<img class="w-8 h-8 me-2 rounded-full" src="/docs/images/people/profile-picture-5.jpg" alt="user photo">
|
|
@@ -1122,13 +1108,13 @@ Use this example to also show the name or email of the user next to the avatar f
|
|
|
1122
1108
|
</li>
|
|
1123
1109
|
</ul>
|
|
1124
1110
|
</div>
|
|
1125
|
-
|
|
1111
|
+
```
|
|
1126
1112
|
|
|
1127
1113
|
## Dropdown navbar
|
|
1128
1114
|
|
|
1129
1115
|
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
1116
|
|
|
1131
|
-
|
|
1117
|
+
```html
|
|
1132
1118
|
|
|
1133
1119
|
<nav class="bg-neutral-primary border-default">
|
|
1134
1120
|
<div class="max-w-screen-xl flex flex-wrap items-center justify-between mx-auto px-4 py-2.5">
|
|
@@ -1178,13 +1164,13 @@ You can also use the dropdown element inside a navigation bar and add a second l
|
|
|
1178
1164
|
</div>
|
|
1179
1165
|
</div>
|
|
1180
1166
|
</nav>
|
|
1181
|
-
|
|
1167
|
+
```
|
|
1182
1168
|
|
|
1183
1169
|
## Dropdown datepicker
|
|
1184
1170
|
|
|
1185
1171
|
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
1172
|
|
|
1187
|
-
|
|
1173
|
+
```html
|
|
1188
1174
|
<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
1175
|
31 Nov <p class="ms-1"> - 31 Dev </p>
|
|
1190
1176
|
<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>
|
|
@@ -1209,13 +1195,13 @@ Use this example to show a date range picker inside a dropdown menu. Use the `da
|
|
|
1209
1195
|
</div>
|
|
1210
1196
|
</div>
|
|
1211
1197
|
</div>
|
|
1212
|
-
|
|
1198
|
+
```
|
|
1213
1199
|
|
|
1214
1200
|
## Sizes
|
|
1215
1201
|
|
|
1216
1202
|
The dropdown menus work with buttons of all sizes including smaller or larger ones.
|
|
1217
1203
|
|
|
1218
|
-
|
|
1204
|
+
```html
|
|
1219
1205
|
<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
1206
|
Small dropdown
|
|
1221
1207
|
<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>
|
|
@@ -1261,13 +1247,13 @@ The dropdown menus work with buttons of all sizes including smaller or larger on
|
|
|
1261
1247
|
</li>
|
|
1262
1248
|
</ul>
|
|
1263
1249
|
</div>
|
|
1264
|
-
|
|
1250
|
+
```
|
|
1265
1251
|
|
|
1266
1252
|
## Placement
|
|
1267
1253
|
|
|
1268
1254
|
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
1255
|
|
|
1270
|
-
|
|
1256
|
+
```html
|
|
1271
1257
|
<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
1258
|
Dropdown top
|
|
1273
1259
|
<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>
|
|
@@ -1359,13 +1345,13 @@ You can also use the `data-dropdown-placement={top|right|bottom|left}` data attr
|
|
|
1359
1345
|
</li>
|
|
1360
1346
|
</ul>
|
|
1361
1347
|
</div>
|
|
1362
|
-
|
|
1348
|
+
```
|
|
1363
1349
|
|
|
1364
1350
|
### Double placement
|
|
1365
1351
|
|
|
1366
1352
|
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
1353
|
|
|
1368
|
-
|
|
1354
|
+
```html
|
|
1369
1355
|
<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
1356
|
<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
1357
|
Dropdown left end
|
|
@@ -1411,7 +1397,7 @@ You can combine the placement options by using the `top|right|bottom|left-{start
|
|
|
1411
1397
|
</li>
|
|
1412
1398
|
</ul>
|
|
1413
1399
|
</div>
|
|
1414
|
-
|
|
1400
|
+
```
|
|
1415
1401
|
|
|
1416
1402
|
## Dropdown offset
|
|
1417
1403
|
|
|
@@ -1421,7 +1407,7 @@ Use the offset options on the dropdown component to set the distance and skiddin
|
|
|
1421
1407
|
|
|
1422
1408
|
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
1409
|
|
|
1424
|
-
|
|
1410
|
+
```html
|
|
1425
1411
|
<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
1412
|
Dropdown button
|
|
1427
1413
|
<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>
|
|
@@ -1444,13 +1430,13 @@ Use the `data-dropdown-offset-distance={pixels}` data attribute to set the numbe
|
|
|
1444
1430
|
</li>
|
|
1445
1431
|
</ul>
|
|
1446
1432
|
</div>
|
|
1447
|
-
|
|
1433
|
+
```
|
|
1448
1434
|
|
|
1449
1435
|
### Skidding
|
|
1450
1436
|
|
|
1451
1437
|
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
1438
|
|
|
1453
|
-
|
|
1439
|
+
```html
|
|
1454
1440
|
<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
1441
|
Dropdown button
|
|
1456
1442
|
<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>
|
|
@@ -1473,7 +1459,7 @@ The `data-dropdown-offset-skidding={pixels}` data attribute can be used to move
|
|
|
1473
1459
|
</li>
|
|
1474
1460
|
</ul>
|
|
1475
1461
|
</div>
|
|
1476
|
-
|
|
1462
|
+
```
|
|
1477
1463
|
|
|
1478
1464
|
## More examples
|
|
1479
1465
|
|
|
@@ -1774,7 +1760,7 @@ First of all, you need to set the main target element which will be the dropdown
|
|
|
1774
1760
|
|
|
1775
1761
|
After that, you can also optionally set an options object to set the placement of the dropdown menu and callback functions.
|
|
1776
1762
|
|
|
1777
|
-
|
|
1763
|
+
```javascript
|
|
1778
1764
|
// set the dropdown menu element
|
|
1779
1765
|
const $targetEl = document.getElementById('dropdownMenu');
|
|
1780
1766
|
|
|
@@ -1805,11 +1791,11 @@ const instanceOptions = {
|
|
|
1805
1791
|
id: 'dropdownMenu',
|
|
1806
1792
|
override: true
|
|
1807
1793
|
};
|
|
1808
|
-
|
|
1794
|
+
```
|
|
1809
1795
|
|
|
1810
1796
|
Create a new Dropdown object based on the options above.
|
|
1811
1797
|
|
|
1812
|
-
|
|
1798
|
+
```javascript
|
|
1813
1799
|
import { Dropdown } from 'flowbite';
|
|
1814
1800
|
|
|
1815
1801
|
/*
|
|
@@ -1819,11 +1805,11 @@ import { Dropdown } from 'flowbite';
|
|
|
1819
1805
|
* instanceOptions: optional
|
|
1820
1806
|
*/
|
|
1821
1807
|
const dropdown = new Dropdown($targetEl, $triggerEl, options, instanceOptions);
|
|
1822
|
-
|
|
1808
|
+
```
|
|
1823
1809
|
|
|
1824
1810
|
Use the `show` and `hide` methods on the Dropdown object to programmatically show or hide the dropdown menu directly from JavaScript.
|
|
1825
1811
|
|
|
1826
|
-
|
|
1812
|
+
```javascript
|
|
1827
1813
|
// show the dropdown menu
|
|
1828
1814
|
dropdown.show();
|
|
1829
1815
|
|
|
@@ -1835,13 +1821,13 @@ dropdown.toggle();
|
|
|
1835
1821
|
|
|
1836
1822
|
// check if dropdown is visible/open
|
|
1837
1823
|
dropdown.isVisible();
|
|
1838
|
-
|
|
1824
|
+
```
|
|
1839
1825
|
|
|
1840
1826
|
### HTML Markup
|
|
1841
1827
|
|
|
1842
1828
|
Use the following HTML code for the JavaScript example above.
|
|
1843
1829
|
|
|
1844
|
-
|
|
1830
|
+
```html
|
|
1845
1831
|
<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
1832
|
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m1 1 4 4 4-4"/>
|
|
1847
1833
|
</svg>
|
|
@@ -1864,15 +1850,15 @@ Use the following HTML code for the JavaScript example above.
|
|
|
1864
1850
|
</li>
|
|
1865
1851
|
</ul>
|
|
1866
1852
|
</div>
|
|
1867
|
-
|
|
1853
|
+
```
|
|
1868
1854
|
|
|
1869
1855
|
### TypeScript
|
|
1870
1856
|
|
|
1871
|
-
If you're using the
|
|
1857
|
+
If you're using the TypeScript configuration from Flowbite then you can import the types for the Dropdown class, parameters and its options.
|
|
1872
1858
|
|
|
1873
1859
|
Here's an example that applies the types from Flowbite to the code above:
|
|
1874
1860
|
|
|
1875
|
-
|
|
1861
|
+
```typescript
|
|
1876
1862
|
import { Dropdown } from 'flowbite';
|
|
1877
1863
|
import type { DropdownOptions, DropdownInterface } from 'flowbite';
|
|
1878
1864
|
import type { InstanceOptions } from 'flowbite';
|
|
@@ -1922,4 +1908,4 @@ const dropdown: DropdownInterface = new Dropdown(
|
|
|
1922
1908
|
|
|
1923
1909
|
// show the dropdown
|
|
1924
1910
|
dropdown.show();
|
|
1925
|
-
|
|
1911
|
+
```
|