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
package/data/components/modal.md
CHANGED
|
@@ -1,17 +1,3 @@
|
|
|
1
|
-
---
|
|
2
|
-
layout: docs
|
|
3
|
-
title: Tailwind CSS Modal - Flowbite
|
|
4
|
-
description: Use the modal component to show interactive dialogs and notifications to your website users available in multiple sizes, colors, and styles
|
|
5
|
-
group: components
|
|
6
|
-
toc: true
|
|
7
|
-
requires_js: true
|
|
8
|
-
|
|
9
|
-
previous: Mega menu
|
|
10
|
-
previousLink: components/mega-menu/
|
|
11
|
-
next: Navbar
|
|
12
|
-
nextLink: components/navbar/
|
|
13
|
-
---
|
|
14
|
-
|
|
15
1
|
The modal component can be used as an interactive dialog on top of the main content area of the website to show notifications and gather information using form elements from your website users.
|
|
16
2
|
|
|
17
3
|
Get started with multiple sizes, colors, and styles built with the utility classes from Tailwind CSS and the components from Flowbite.
|
|
@@ -26,7 +12,7 @@ If you want to toggle the visibility, show, or hide the modal you can use the fo
|
|
|
26
12
|
- `data-modal-show="modalID"` - show the modal
|
|
27
13
|
- `data-modal-hide="modalID"` - close the modal
|
|
28
14
|
|
|
29
|
-
|
|
15
|
+
```html
|
|
30
16
|
|
|
31
17
|
<!-- Modal toggle -->
|
|
32
18
|
<button data-modal-target="default-modal" data-modal-toggle="default-modal" class="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">
|
|
@@ -65,13 +51,13 @@ If you want to toggle the visibility, show, or hide the modal you can use the fo
|
|
|
65
51
|
</div>
|
|
66
52
|
</div>
|
|
67
53
|
</div>
|
|
68
|
-
|
|
54
|
+
```
|
|
69
55
|
|
|
70
56
|
## Static modal
|
|
71
57
|
|
|
72
58
|
Use the `data-modal-backdrop="static"` data attribute to prevent the modal from closing when clicking outside of it. This can be used with situations where you want to force the user to choose an option such as a cookie notice or when taking a survey.
|
|
73
59
|
|
|
74
|
-
|
|
60
|
+
```html
|
|
75
61
|
|
|
76
62
|
<!-- Modal toggle -->
|
|
77
63
|
<button data-modal-target="static-modal" data-modal-toggle="static-modal" class="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">
|
|
@@ -110,13 +96,13 @@ Use the `data-modal-backdrop="static"` data attribute to prevent the modal from
|
|
|
110
96
|
</div>
|
|
111
97
|
</div>
|
|
112
98
|
</div>
|
|
113
|
-
|
|
99
|
+
```
|
|
114
100
|
|
|
115
101
|
## Pop-up modal
|
|
116
102
|
|
|
117
103
|
You can use this modal example to show a pop-up decision dialog to your users especially when deleting an item and making sure if the user really wants to do that by double confirming.
|
|
118
104
|
|
|
119
|
-
|
|
105
|
+
```html
|
|
120
106
|
<button data-modal-target="popup-modal" data-modal-toggle="popup-modal" class="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">
|
|
121
107
|
Toggle modal
|
|
122
108
|
</button>
|
|
@@ -141,13 +127,13 @@ Toggle modal
|
|
|
141
127
|
</div>
|
|
142
128
|
</div>
|
|
143
129
|
</div>
|
|
144
|
-
|
|
130
|
+
```
|
|
145
131
|
|
|
146
132
|
## Form element
|
|
147
133
|
|
|
148
134
|
Use this modal example with form input element to receive information from your users with the advantage of not having to link to another page but keeping the user on the currently active page. A great example would be a login or a register form.
|
|
149
135
|
|
|
150
|
-
|
|
136
|
+
```html
|
|
151
137
|
|
|
152
138
|
<!-- Modal toggle -->
|
|
153
139
|
<button data-modal-target="authentication-modal" data-modal-toggle="authentication-modal" class="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">
|
|
@@ -192,13 +178,13 @@ Use this modal example with form input element to receive information from your
|
|
|
192
178
|
</div>
|
|
193
179
|
</div>
|
|
194
180
|
</div>
|
|
195
|
-
|
|
181
|
+
```
|
|
196
182
|
|
|
197
183
|
## Modal with CRUD
|
|
198
184
|
|
|
199
185
|
Use this example of a modal to use within CRUD (Create, Read, Update, Delete) operations to create new items, update existing ones, or delete them with a form inside of the modal.
|
|
200
186
|
|
|
201
|
-
|
|
187
|
+
```html
|
|
202
188
|
|
|
203
189
|
<!-- Modal toggle -->
|
|
204
190
|
<button data-modal-target="crud-modal" data-modal-toggle="crud-modal" class="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">
|
|
@@ -257,13 +243,13 @@ Use this example of a modal to use within CRUD (Create, Read, Update, Delete) op
|
|
|
257
243
|
</div>
|
|
258
244
|
</div>
|
|
259
245
|
</div>
|
|
260
|
-
|
|
246
|
+
```
|
|
261
247
|
|
|
262
248
|
## Modal with radio inputs
|
|
263
249
|
|
|
264
250
|
This example can be used to show a list of options to your users by using advanced radio inputs with a custom design.
|
|
265
251
|
|
|
266
|
-
|
|
252
|
+
```html
|
|
267
253
|
|
|
268
254
|
<!-- Modal toggle -->
|
|
269
255
|
<button data-modal-target="select-modal" data-modal-toggle="select-modal" class="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">
|
|
@@ -337,13 +323,13 @@ This example can be used to show a list of options to your users by using advanc
|
|
|
337
323
|
</div>
|
|
338
324
|
</div>
|
|
339
325
|
</div>
|
|
340
|
-
|
|
326
|
+
```
|
|
341
327
|
|
|
342
328
|
## Modal with timeline
|
|
343
329
|
|
|
344
330
|
Use this example to show a timeline of events to your users with a modal. This can be used to show a changelog of your product or a timeline of events.
|
|
345
331
|
|
|
346
|
-
|
|
332
|
+
```html
|
|
347
333
|
|
|
348
334
|
<!-- Modal toggle -->
|
|
349
335
|
<button data-modal-target="timeline-modal" data-modal-toggle="timeline-modal" class="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">
|
|
@@ -407,13 +393,13 @@ Use this example to show a timeline of events to your users with a modal. This c
|
|
|
407
393
|
</div>
|
|
408
394
|
</div>
|
|
409
395
|
</div>
|
|
410
|
-
|
|
396
|
+
```
|
|
411
397
|
|
|
412
398
|
## Modal with progress bar
|
|
413
399
|
|
|
414
400
|
This modal can be used to show the progress of a task to your users. It can be used to show the progress of a file upload or a task that is being processed.
|
|
415
401
|
|
|
416
|
-
|
|
402
|
+
```html
|
|
417
403
|
|
|
418
404
|
<!-- Modal toggle -->
|
|
419
405
|
<button data-modal-target="progress-modal" data-modal-toggle="progress-modal" class="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">
|
|
@@ -449,14 +435,14 @@ This modal can be used to show the progress of a task to your users. It can be u
|
|
|
449
435
|
</div>
|
|
450
436
|
</div>
|
|
451
437
|
</div>
|
|
452
|
-
|
|
438
|
+
```
|
|
453
439
|
|
|
454
440
|
|
|
455
441
|
## Crypto wallet
|
|
456
442
|
|
|
457
443
|
Use this web3 modal component to show crypto wallet connection options like MetaMask or WalletConnect when building a website based on NFT authentication and collectibles.
|
|
458
444
|
|
|
459
|
-
|
|
445
|
+
```html
|
|
460
446
|
<button type="button" data-modal-target="crypto-modal" data-modal-toggle="crypto-modal" class="inline-flex items-center text-body bg-neutral-secondary-medium box-border border border-default-medium hover:bg-neutral-tertiary-medium hover:text-heading focus:ring-4 focus:ring-neutral-tertiary shadow-xs font-medium leading-5 rounded-base text-sm px-4 py-2.5 focus:outline-none">
|
|
461
447
|
<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="M17 8H5m12 0a1 1 0 0 1 1 1v2.6M17 8l-4-4M5 8a1 1 0 0 0-1 1v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-2.6M5 8l4-4 4 4m6 4h-4a2 2 0 1 0 0 4h4a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1Z"/></svg>
|
|
462
448
|
Connect wallet
|
|
@@ -523,13 +509,13 @@ Use this web3 modal component to show crypto wallet connection options like Meta
|
|
|
523
509
|
</div>
|
|
524
510
|
</div>
|
|
525
511
|
</div>
|
|
526
|
-
|
|
512
|
+
```
|
|
527
513
|
|
|
528
514
|
## Sizes
|
|
529
515
|
|
|
530
516
|
You can use four different modal sizing options starting from small to extra large, but keep in mind that the width of these modals will remain the same when browsing on smaller devices.
|
|
531
517
|
|
|
532
|
-
|
|
518
|
+
```html
|
|
533
519
|
|
|
534
520
|
<div class="block space-y-4 md:flex md:space-y-0 md:space-x-4 rtl:space-x-reverse">
|
|
535
521
|
<!-- Modal toggle -->
|
|
@@ -678,7 +664,7 @@ You can use four different modal sizing options starting from small to extra lar
|
|
|
678
664
|
</div>
|
|
679
665
|
</div>
|
|
680
666
|
</div>
|
|
681
|
-
|
|
667
|
+
```
|
|
682
668
|
|
|
683
669
|
## Placement
|
|
684
670
|
|
|
@@ -686,7 +672,7 @@ Use the `data-modal-placement` data attribute on the modal element to set the po
|
|
|
686
672
|
|
|
687
673
|
The default position is the center of the page.
|
|
688
674
|
|
|
689
|
-
|
|
675
|
+
```html
|
|
690
676
|
|
|
691
677
|
<div class="block space-y-4 md:flex md:space-y-0 md:space-x-4 md:rtl:space-x-reverse">
|
|
692
678
|
<!-- Modal toggle -->
|
|
@@ -835,7 +821,7 @@ The default position is the center of the page.
|
|
|
835
821
|
</div>
|
|
836
822
|
</div>
|
|
837
823
|
</div>
|
|
838
|
-
|
|
824
|
+
```
|
|
839
825
|
|
|
840
826
|
## More examples
|
|
841
827
|
|
|
@@ -1111,7 +1097,7 @@ Check out the following JavaScript example to learn how to initialize, set the o
|
|
|
1111
1097
|
|
|
1112
1098
|
First of all, create a new JavaScript element object for the first parameter of the Modal object and another options object to set the placement, backdrop styles, and callback functions.
|
|
1113
1099
|
|
|
1114
|
-
|
|
1100
|
+
```javascript
|
|
1115
1101
|
// set the modal menu element
|
|
1116
1102
|
const $targetEl = document.getElementById('modalEl');
|
|
1117
1103
|
|
|
@@ -1138,11 +1124,11 @@ const instanceOptions = {
|
|
|
1138
1124
|
id: 'modalEl',
|
|
1139
1125
|
override: true
|
|
1140
1126
|
};
|
|
1141
|
-
|
|
1127
|
+
```
|
|
1142
1128
|
|
|
1143
1129
|
Create a new Modal object based on the options above.
|
|
1144
1130
|
|
|
1145
|
-
|
|
1131
|
+
```javascript
|
|
1146
1132
|
import { Modal } from 'flowbite';
|
|
1147
1133
|
|
|
1148
1134
|
/*
|
|
@@ -1150,40 +1136,40 @@ import { Modal } from 'flowbite';
|
|
|
1150
1136
|
* options: optional
|
|
1151
1137
|
*/
|
|
1152
1138
|
const modal = new Modal($targetEl, options, instanceOptions);
|
|
1153
|
-
|
|
1139
|
+
```
|
|
1154
1140
|
|
|
1155
1141
|
Use the `show` and `hide` methods to show and hide the modal component directly from JavaScript.
|
|
1156
1142
|
|
|
1157
|
-
|
|
1143
|
+
```javascript
|
|
1158
1144
|
// show the modal
|
|
1159
1145
|
modal.show();
|
|
1160
1146
|
|
|
1161
1147
|
// hide the modal
|
|
1162
1148
|
modal.hide();
|
|
1163
|
-
|
|
1149
|
+
```
|
|
1164
1150
|
|
|
1165
1151
|
Use the `toggle` method to toggle the visibility of the modal.
|
|
1166
1152
|
|
|
1167
|
-
|
|
1153
|
+
```javascript
|
|
1168
1154
|
// toggle the modal
|
|
1169
1155
|
modal.toggle();
|
|
1170
|
-
|
|
1156
|
+
```
|
|
1171
1157
|
|
|
1172
1158
|
Use the `isHidden` or `isVisible` method to check if the modal is visible or not.
|
|
1173
1159
|
|
|
1174
|
-
|
|
1160
|
+
```javascript
|
|
1175
1161
|
// true if hidden
|
|
1176
1162
|
modal.isHidden();
|
|
1177
1163
|
|
|
1178
1164
|
// true if visible
|
|
1179
1165
|
modal.isVisible();
|
|
1180
|
-
|
|
1166
|
+
```
|
|
1181
1167
|
|
|
1182
1168
|
### HTML Markup
|
|
1183
1169
|
|
|
1184
1170
|
Use the following HTML code for the JavaScript example above.
|
|
1185
1171
|
|
|
1186
|
-
|
|
1172
|
+
```html
|
|
1187
1173
|
<div
|
|
1188
1174
|
id="modalEl"
|
|
1189
1175
|
tabindex="-1"
|
|
@@ -1265,15 +1251,15 @@ Use the following HTML code for the JavaScript example above.
|
|
|
1265
1251
|
</div>
|
|
1266
1252
|
</div>
|
|
1267
1253
|
</div>
|
|
1268
|
-
|
|
1254
|
+
```
|
|
1269
1255
|
|
|
1270
1256
|
### TypeScript
|
|
1271
1257
|
|
|
1272
|
-
If you're using the
|
|
1258
|
+
If you're using the TypeScript configuration from Flowbite then you can import the types for the Modal class, parameters and its options.
|
|
1273
1259
|
|
|
1274
1260
|
Here's an example that applies the types from Flowbite to the code above:
|
|
1275
1261
|
|
|
1276
|
-
|
|
1262
|
+
```typescript
|
|
1277
1263
|
import { Modal } from 'flowbite';
|
|
1278
1264
|
import type { ModalOptions, ModalInterface } from 'flowbite';
|
|
1279
1265
|
import type { InstanceOptions } from 'flowbite';
|
|
@@ -1306,4 +1292,4 @@ const instanceOptions: InstanceOptions = {
|
|
|
1306
1292
|
const modal: ModalInterface = new Modal($modalElement, modalOptions, instanceOptions);
|
|
1307
1293
|
|
|
1308
1294
|
modal.show();
|
|
1309
|
-
|
|
1295
|
+
```
|
|
@@ -1,27 +1,13 @@
|
|
|
1
|
-
---
|
|
2
|
-
layout: docs
|
|
3
|
-
title: Tailwind CSS Navbar - Flowbite
|
|
4
|
-
description: The navbar component can be used to show a list of navigation links positioned on the top side of your page based on multiple layouts, sizes, and dropdowns
|
|
5
|
-
group: components
|
|
6
|
-
toc: true
|
|
7
|
-
requires_js: true
|
|
8
|
-
|
|
9
|
-
previous: Modal
|
|
10
|
-
previousLink: components/modal/
|
|
11
|
-
next: Pagination
|
|
12
|
-
nextLink: components/pagination/
|
|
13
|
-
---
|
|
14
|
-
|
|
15
1
|
Get started with the responsive navbar component from Flowbite to quickly set up a navigation menu for your website and set up the logo, list of pages, CTA button, search input, user profile options with a dropdown, and more.
|
|
16
2
|
|
|
17
3
|
## Default navbar
|
|
18
4
|
|
|
19
5
|
Use this example of a navigation bar built with the utility classes from Tailwind CSS to enable users to navigate across the pages of your website.
|
|
20
6
|
|
|
21
|
-
|
|
7
|
+
```html
|
|
22
8
|
<nav class="bg-neutral-primary fixed w-full z-20 top-0 start-0 border-b border-default">
|
|
23
9
|
<div class="max-w-screen-xl flex flex-wrap items-center justify-between mx-auto p-4">
|
|
24
|
-
<a href="
|
|
10
|
+
<a href="https://flowbite.com" class="flex items-center space-x-3 rtl:space-x-reverse">
|
|
25
11
|
<img src="https://flowbite.com/docs/images/logo.svg" class="h-7" alt="Flowbite Logo" />
|
|
26
12
|
<span class="self-center text-xl text-heading font-semibold whitespace-nowrap">Flowbite</span>
|
|
27
13
|
</a>
|
|
@@ -50,13 +36,13 @@ Use this example of a navigation bar built with the utility classes from Tailwin
|
|
|
50
36
|
</div>
|
|
51
37
|
</div>
|
|
52
38
|
</nav>
|
|
53
|
-
|
|
39
|
+
```
|
|
54
40
|
|
|
55
41
|
## Navbar with dropdown
|
|
56
42
|
|
|
57
43
|
This example can be used to show a secondary dropdown menu when clicking on one of the navigation links.
|
|
58
44
|
|
|
59
|
-
|
|
45
|
+
```html
|
|
60
46
|
<nav class="bg-neutral-primary fixed w-full z-20 top-0 start-0 border-default">
|
|
61
47
|
<div class="max-w-screen-xl flex flex-wrap items-center justify-between mx-auto p-4">
|
|
62
48
|
<a href="#" class="flex items-center space-x-3 rtl:space-x-reverse">
|
|
@@ -108,13 +94,13 @@ This example can be used to show a secondary dropdown menu when clicking on one
|
|
|
108
94
|
</div>
|
|
109
95
|
</div>
|
|
110
96
|
</nav>
|
|
111
|
-
|
|
97
|
+
```
|
|
112
98
|
|
|
113
99
|
## Multi-level dropdown
|
|
114
100
|
|
|
115
101
|
Use this example to show multiple layers of dropdown menu by stacking them inside of each other.
|
|
116
102
|
|
|
117
|
-
|
|
103
|
+
```html
|
|
118
104
|
<nav class="bg-neutral-primary fixed w-full z-20 top-0 start-0 border-b border-default">
|
|
119
105
|
<div class="max-w-screen-xl flex flex-wrap items-center justify-between mx-auto p-4">
|
|
120
106
|
<a href="#" class="flex items-center space-x-3 rtl:space-x-reverse">
|
|
@@ -185,13 +171,13 @@ Use this example to show multiple layers of dropdown menu by stacking them insid
|
|
|
185
171
|
</div>
|
|
186
172
|
</div>
|
|
187
173
|
</nav>
|
|
188
|
-
|
|
174
|
+
```
|
|
189
175
|
|
|
190
176
|
## Sticky navbar
|
|
191
177
|
|
|
192
178
|
Use this example to keep the navbar positioned fixed to the top side as you scroll down the document page.
|
|
193
179
|
|
|
194
|
-
|
|
180
|
+
```html
|
|
195
181
|
|
|
196
182
|
<nav class="bg-neutral-primary fixed w-full z-20 top-0 start-0 border-b border-default">
|
|
197
183
|
<div class="max-w-screen-xl flex flex-wrap items-center justify-between mx-auto p-4">
|
|
@@ -224,13 +210,13 @@ Use this example to keep the navbar positioned fixed to the top side as you scro
|
|
|
224
210
|
</div>
|
|
225
211
|
</div>
|
|
226
212
|
</nav>
|
|
227
|
-
|
|
213
|
+
```
|
|
228
214
|
|
|
229
215
|
## Navbar with submenu
|
|
230
216
|
|
|
231
217
|
Use this example to show another subnav below the main navbar element.
|
|
232
218
|
|
|
233
|
-
|
|
219
|
+
```html
|
|
234
220
|
<header class="fixed w-full z-20 top-0 start-0">
|
|
235
221
|
<nav class="bg-neutral-primary">
|
|
236
222
|
<div class="flex flex-wrap justify-between items-center mx-auto max-w-screen-xl p-4">
|
|
@@ -265,17 +251,17 @@ Use this example to show another subnav below the main navbar element.
|
|
|
265
251
|
</div>
|
|
266
252
|
</nav>
|
|
267
253
|
</header>
|
|
268
|
-
|
|
254
|
+
```
|
|
269
255
|
|
|
270
256
|
## Navbar with search
|
|
271
257
|
|
|
272
258
|
Use this example of a navbar element to also show a search input element that you can integrate for a site-wide search.
|
|
273
259
|
|
|
274
|
-
|
|
260
|
+
```html
|
|
275
261
|
|
|
276
262
|
<nav class="bg-neutral-primary fixed w-full z-20 top-0 start-0 border-b border-default">
|
|
277
263
|
<div class="max-w-screen-xl flex flex-wrap items-center justify-between mx-auto p-4">
|
|
278
|
-
<a href="
|
|
264
|
+
<a href="https://flowbite.com" class="flex items-center space-x-3 rtl:space-x-reverse">
|
|
279
265
|
<img src="https://flowbite.com/docs/images/logo.svg" class="h-7" alt="Flowbite Logo" />
|
|
280
266
|
<span class="self-center text-xl text-heading font-semibold whitespace-nowrap">Flowbite</span>
|
|
281
267
|
</a>
|
|
@@ -317,17 +303,17 @@ Use this example of a navbar element to also show a search input element that yo
|
|
|
317
303
|
</div>
|
|
318
304
|
</div>
|
|
319
305
|
</nav>
|
|
320
|
-
|
|
306
|
+
```
|
|
321
307
|
|
|
322
308
|
## Navbar with CTA button
|
|
323
309
|
|
|
324
310
|
Use the following navbar element to show a call to action button alongside the logo and page links.
|
|
325
311
|
|
|
326
|
-
|
|
312
|
+
```html
|
|
327
313
|
|
|
328
314
|
<nav class="bg-neutral-primary fixed w-full z-20 top-0 start-0 border-b border-default">
|
|
329
315
|
<div class="max-w-screen-xl flex flex-wrap items-center justify-between mx-auto p-4">
|
|
330
|
-
<a href="
|
|
316
|
+
<a href="https://flowbite.com" class="flex items-center space-x-3 rtl:space-x-reverse">
|
|
331
317
|
<img src="https://flowbite.com/docs/images/logo.svg" class="h-7" alt="Flowbite Logo" />
|
|
332
318
|
<span class="self-center text-xl text-heading font-semibold whitespace-nowrap">Flowbite</span>
|
|
333
319
|
</a>
|
|
@@ -356,17 +342,17 @@ Use the following navbar element to show a call to action button alongside the l
|
|
|
356
342
|
</div>
|
|
357
343
|
</div>
|
|
358
344
|
</nav>
|
|
359
|
-
|
|
345
|
+
```
|
|
360
346
|
|
|
361
347
|
## Language dropdown
|
|
362
348
|
|
|
363
349
|
Get started with this example to show a language dropdown selector in the navbar component.
|
|
364
350
|
|
|
365
|
-
|
|
351
|
+
```html
|
|
366
352
|
|
|
367
353
|
<nav class="bg-neutral-primary fixed w-full z-20 top-0 start-0 border-b border-default">
|
|
368
354
|
<div class="max-w-screen-xl flex flex-wrap items-center justify-between mx-auto p-4">
|
|
369
|
-
<a href="
|
|
355
|
+
<a href="https://flowbite.com" class="flex items-center space-x-3 rtl:space-x-reverse">
|
|
370
356
|
<img src="https://flowbite.com/docs/images/logo.svg" class="h-7" alt="Flowbite Logo" />
|
|
371
357
|
<span class="self-center text-xl text-heading font-semibold whitespace-nowrap">Flowbite</span>
|
|
372
358
|
</a>
|
|
@@ -438,17 +424,17 @@ Get started with this example to show a language dropdown selector in the navbar
|
|
|
438
424
|
</div>
|
|
439
425
|
</div>
|
|
440
426
|
</nav>
|
|
441
|
-
|
|
427
|
+
```
|
|
442
428
|
|
|
443
429
|
## User menu dropdown
|
|
444
430
|
|
|
445
431
|
Use this example to create a navigation bar with a user profile or button to toggle a dropdown menu.
|
|
446
432
|
|
|
447
|
-
|
|
433
|
+
```html
|
|
448
434
|
|
|
449
435
|
<nav class="bg-neutral-primary fixed w-full z-20 top-0 start-0 border-b border-default">
|
|
450
436
|
<div class="max-w-screen-xl flex flex-wrap items-center justify-between mx-auto p-4">
|
|
451
|
-
<a href="
|
|
437
|
+
<a href="https://flowbite.com" class="flex items-center space-x-3 rtl:space-x-reverse">
|
|
452
438
|
<img src="https://flowbite.com/docs/images/logo.svg" class="h-7" alt="Flowbite Logo" />
|
|
453
439
|
<span class="self-center text-xl text-heading font-semibold whitespace-nowrap">Flowbite</span>
|
|
454
440
|
</a>
|
|
@@ -504,13 +490,13 @@ Use this example to create a navigation bar with a user profile or button to tog
|
|
|
504
490
|
</div>
|
|
505
491
|
</div>
|
|
506
492
|
</nav>
|
|
507
|
-
|
|
493
|
+
```
|
|
508
494
|
|
|
509
495
|
## Mega menu navbar
|
|
510
496
|
|
|
511
497
|
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.
|
|
512
498
|
|
|
513
|
-
|
|
499
|
+
```html
|
|
514
500
|
<nav class="bg-neutral-primary fixed w-full z-20 top-0 start-0 border-b border-default">
|
|
515
501
|
<div class="flex flex-wrap justify-between items-center mx-auto max-w-screen-xl p-4">
|
|
516
502
|
<a href="https://flowbite.com" class="flex items-center space-x-3 rtl:space-x-reverse">
|
|
@@ -609,16 +595,16 @@ You can also use the dropdown element inside a navigation bar and add a second l
|
|
|
609
595
|
</div>
|
|
610
596
|
</div>
|
|
611
597
|
</nav>
|
|
612
|
-
|
|
598
|
+
```
|
|
613
599
|
|
|
614
600
|
## Solid background
|
|
615
601
|
|
|
616
602
|
Use this example to show a solid background for the navbar component instead of being transparent.
|
|
617
603
|
|
|
618
|
-
|
|
604
|
+
```html
|
|
619
605
|
<nav class="bg-neutral-secondary-soft fixed w-full z-20 top-0 start-0 border-b border-default">
|
|
620
606
|
<div class="max-w-screen-xl flex flex-wrap items-center justify-between mx-auto p-4">
|
|
621
|
-
<a href="
|
|
607
|
+
<a href="https://flowbite.com" class="flex items-center space-x-3 rtl:space-x-reverse">
|
|
622
608
|
<img src="https://flowbite.com/docs/images/logo.svg" class="h-7" alt="Flowbite Logo" />
|
|
623
609
|
<span class="self-center text-xl text-heading font-semibold whitespace-nowrap">Flowbite</span>
|
|
624
610
|
</a>
|
|
@@ -647,7 +633,7 @@ Use this example to show a solid background for the navbar component instead of
|
|
|
647
633
|
</div>
|
|
648
634
|
</div>
|
|
649
635
|
</nav>
|
|
650
|
-
|
|
636
|
+
```
|
|
651
637
|
|
|
652
638
|
## Hamburger menu
|
|
653
639
|
|
|
@@ -655,7 +641,7 @@ All of the navbar components from this page have a responsive hamburger menu inc
|
|
|
655
641
|
|
|
656
642
|
Here's an example where you can show the hamburger icon and the menu on all screen sizes.
|
|
657
643
|
|
|
658
|
-
|
|
644
|
+
```html
|
|
659
645
|
|
|
660
646
|
<nav class="bg-neutral-secondary-soft fixed w-full z-20 top-0 start-0 border-b border-default">
|
|
661
647
|
<div class="max-w-screen-xl flex flex-wrap items-center justify-between mx-auto p-4">
|
|
@@ -685,7 +671,7 @@ Here's an example where you can show the hamburger icon and the menu on all scre
|
|
|
685
671
|
</div>
|
|
686
672
|
</div>
|
|
687
673
|
</nav>
|
|
688
|
-
|
|
674
|
+
```
|
|
689
675
|
|
|
690
676
|
## More examples
|
|
691
677
|
|
|
@@ -914,7 +900,7 @@ Check out the following example to learn how to initialize and use the methods o
|
|
|
914
900
|
|
|
915
901
|
First of all, you need to set the object parameters where the target element is required and the other two are optional.
|
|
916
902
|
|
|
917
|
-
|
|
903
|
+
```javascript
|
|
918
904
|
// set the target element that will be collapsed or expanded (eg. navbar menu)
|
|
919
905
|
const $targetEl = document.getElementById('targetEl');
|
|
920
906
|
|
|
@@ -939,11 +925,11 @@ const instanceOptions = {
|
|
|
939
925
|
override: true
|
|
940
926
|
};
|
|
941
927
|
|
|
942
|
-
|
|
928
|
+
```
|
|
943
929
|
|
|
944
930
|
Next step is to create a new instance of a Collapse object using the parameters we have set above.
|
|
945
931
|
|
|
946
|
-
|
|
932
|
+
```javascript
|
|
947
933
|
import { Collapse } from 'flowbite';
|
|
948
934
|
|
|
949
935
|
/*
|
|
@@ -952,11 +938,11 @@ import { Collapse } from 'flowbite';
|
|
|
952
938
|
* options: optional
|
|
953
939
|
*/
|
|
954
940
|
const collapse = new Collapse($targetEl, $triggerEl, options, instanceOptions);
|
|
955
|
-
|
|
941
|
+
```
|
|
956
942
|
|
|
957
943
|
Now you can programmatically expand or collapse the target element using the methods of the Collapse object.
|
|
958
944
|
|
|
959
|
-
|
|
945
|
+
```javascript
|
|
960
946
|
// show the target element
|
|
961
947
|
collapse.expand();
|
|
962
948
|
|
|
@@ -965,13 +951,13 @@ collapse.collapse();
|
|
|
965
951
|
|
|
966
952
|
// toggle the visibility of the target element
|
|
967
953
|
collapse.toggle();
|
|
968
|
-
|
|
954
|
+
```
|
|
969
955
|
|
|
970
956
|
### HTML Markup
|
|
971
957
|
|
|
972
958
|
Here is an example of the HTML markup that you can use for the JavaScript example above. Please note that you should use the `hidden` class from Tailwind CSS to hide the target element by default.
|
|
973
959
|
|
|
974
|
-
|
|
960
|
+
```html
|
|
975
961
|
<button type="button" id="triggerEl" aria-expanded="false" class="text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:ring-blue-300 font-medium rounded-base text-sm px-5 py-2.5 mr-2 mb-2 dark:bg-blue-600 dark:hover:bg-blue-700 focus:outline-none dark:focus:ring-blue-800">Trigger collapse</button>
|
|
976
962
|
|
|
977
963
|
<!-- Target element -->
|
|
@@ -997,15 +983,15 @@ Here is an example of the HTML markup that you can use for the JavaScript exampl
|
|
|
997
983
|
<li class="w-full rounded-b-lg px-4 py-2">Download</li>
|
|
998
984
|
</ul>
|
|
999
985
|
</div>
|
|
1000
|
-
|
|
986
|
+
```
|
|
1001
987
|
|
|
1002
988
|
### TypeScript
|
|
1003
989
|
|
|
1004
|
-
If you're using the
|
|
990
|
+
If you're using the TypeScript configuration from Flowbite then you can import the types for the Collapse object, parameters and its options.
|
|
1005
991
|
|
|
1006
992
|
Here's an example that applies the types from Flowbite to the code above:
|
|
1007
993
|
|
|
1008
|
-
|
|
994
|
+
```typescript
|
|
1009
995
|
import { Collapse } from 'flowbite';
|
|
1010
996
|
import type { CollapseOptions, CollapseInterface } from 'flowbite';
|
|
1011
997
|
import type { InstanceOptions } from 'flowbite';
|
|
@@ -1050,4 +1036,4 @@ const collapse: CollapseInterface = new Collapse(
|
|
|
1050
1036
|
|
|
1051
1037
|
// show the target element
|
|
1052
1038
|
collapse.expand();
|
|
1053
|
-
|
|
1039
|
+
```
|