flowbite-mcp 1.1.2 → 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,22 +1,8 @@
|
|
|
1
|
-
---
|
|
2
|
-
layout: docs
|
|
3
|
-
title: Tailwind CSS Drawer (offcanvas) - Flowbite
|
|
4
|
-
description: The Drawer component can be used as a hidden off-canvas sidebar for navigation and to show other information based on multiple styles and placements
|
|
5
|
-
group: components
|
|
6
|
-
requires_js: true
|
|
7
|
-
toc: true
|
|
8
|
-
|
|
9
|
-
previous: Device mockups
|
|
10
|
-
previousLink: components/device-mockups/
|
|
11
|
-
next: Dropdowns
|
|
12
|
-
nextLink: components/dropdowns/
|
|
13
|
-
---
|
|
14
|
-
|
|
15
1
|
Use the Drawer component (or "off-canvas") to show a fixed element relative to the document page from any side for navigation, contact forms, informational purposes or other user actions.
|
|
16
2
|
|
|
17
3
|
You can set multiple options such as the placement, activate body scrolling, show or hide the backdrop and even use the swipeable edge functionality to show a small part of the drawer when it is not shown completely.
|
|
18
4
|
|
|
19
|
-
To enable interactivity via data attributes and the Drawer API you need to include
|
|
5
|
+
To enable interactivity via data attributes and the Drawer API you need to include Flowbite's JavaScript file.
|
|
20
6
|
|
|
21
7
|
## Default drawer
|
|
22
8
|
|
|
@@ -32,7 +18,7 @@ For accessibility you should also apply the `aria-controls={id}` attribute to th
|
|
|
32
18
|
|
|
33
19
|
You can also avoid the drawer flickering and hide it by default by applying the following classes to the Drawer element: `transition-transform left-0 top-0 -translate-x-full`. This will set the component off-canvas.
|
|
34
20
|
|
|
35
|
-
|
|
21
|
+
```html
|
|
36
22
|
|
|
37
23
|
<!-- drawer init and toggle -->
|
|
38
24
|
<div class="text-center">
|
|
@@ -63,13 +49,13 @@ You can also avoid the drawer flickering and hide it by default by applying the
|
|
|
63
49
|
</button>
|
|
64
50
|
</div>
|
|
65
51
|
</div>
|
|
66
|
-
|
|
52
|
+
```
|
|
67
53
|
|
|
68
54
|
## Drawer navigation
|
|
69
55
|
|
|
70
56
|
Use this example to show a navigational sidebar inside the drawer component.
|
|
71
57
|
|
|
72
|
-
|
|
58
|
+
```html
|
|
73
59
|
|
|
74
60
|
<!-- drawer init and show -->
|
|
75
61
|
<div class="text-center">
|
|
@@ -151,13 +137,13 @@ Use this example to show a navigational sidebar inside the drawer component.
|
|
|
151
137
|
</ul>
|
|
152
138
|
</div>
|
|
153
139
|
</div>
|
|
154
|
-
|
|
140
|
+
```
|
|
155
141
|
|
|
156
142
|
## Contact form
|
|
157
143
|
|
|
158
144
|
Use this example to show a contact form inside the drawer component.
|
|
159
145
|
|
|
160
|
-
|
|
146
|
+
```html
|
|
161
147
|
|
|
162
148
|
<!-- drawer init and show -->
|
|
163
149
|
<div class="text-center">
|
|
@@ -204,13 +190,13 @@ Use this example to show a contact form inside the drawer component.
|
|
|
204
190
|
<a href="#" class="hover:underline">212-456-7890</a>
|
|
205
191
|
</p>
|
|
206
192
|
</div>
|
|
207
|
-
|
|
193
|
+
```
|
|
208
194
|
|
|
209
195
|
## Form elements
|
|
210
196
|
|
|
211
197
|
Use this example if you want to add form elements inside the drawer component including datepickers.
|
|
212
198
|
|
|
213
|
-
|
|
199
|
+
```html
|
|
214
200
|
|
|
215
201
|
<!-- drawer init and show -->
|
|
216
202
|
<div class="text-center">
|
|
@@ -267,7 +253,7 @@ Use this example if you want to add form elements inside the drawer component in
|
|
|
267
253
|
</button>
|
|
268
254
|
</form>
|
|
269
255
|
</div>
|
|
270
|
-
|
|
256
|
+
```
|
|
271
257
|
|
|
272
258
|
## Placement
|
|
273
259
|
|
|
@@ -279,7 +265,7 @@ Use this example where you can position the drawer component on the left side of
|
|
|
279
265
|
|
|
280
266
|
To span the full height of the page you'll have to add the `h-screen` class to the drawer component.
|
|
281
267
|
|
|
282
|
-
|
|
268
|
+
```html
|
|
283
269
|
|
|
284
270
|
<!-- drawer init and toggle -->
|
|
285
271
|
<div class="text-center">
|
|
@@ -310,7 +296,7 @@ To span the full height of the page you'll have to add the `h-screen` class to t
|
|
|
310
296
|
</button>
|
|
311
297
|
</div>
|
|
312
298
|
</div>
|
|
313
|
-
|
|
299
|
+
```
|
|
314
300
|
|
|
315
301
|
### Right drawer
|
|
316
302
|
|
|
@@ -318,7 +304,7 @@ Use this example to show the drawer component on the right side of the page.
|
|
|
318
304
|
|
|
319
305
|
To span the full height of the page you'll have to add the `h-screen` class to the drawer component.
|
|
320
306
|
|
|
321
|
-
|
|
307
|
+
```html
|
|
322
308
|
|
|
323
309
|
<!-- drawer init and toggle -->
|
|
324
310
|
<div class="text-center">
|
|
@@ -349,13 +335,13 @@ To span the full height of the page you'll have to add the `h-screen` class to t
|
|
|
349
335
|
</button>
|
|
350
336
|
</div>
|
|
351
337
|
</div>
|
|
352
|
-
|
|
338
|
+
```
|
|
353
339
|
|
|
354
340
|
### Top drawer
|
|
355
341
|
|
|
356
342
|
Use this example to show the drawer on the top side of the page.
|
|
357
343
|
|
|
358
|
-
|
|
344
|
+
```html
|
|
359
345
|
|
|
360
346
|
<!-- drawer init and toggle -->
|
|
361
347
|
<div class="text-center">
|
|
@@ -386,13 +372,13 @@ Use this example to show the drawer on the top side of the page.
|
|
|
386
372
|
</button>
|
|
387
373
|
</div>
|
|
388
374
|
</div>
|
|
389
|
-
|
|
375
|
+
```
|
|
390
376
|
|
|
391
377
|
### Bottom drawer
|
|
392
378
|
|
|
393
379
|
Use this example to show the drawer on the bottom side of the page.
|
|
394
380
|
|
|
395
|
-
|
|
381
|
+
```html
|
|
396
382
|
|
|
397
383
|
<div class="text-center">
|
|
398
384
|
<button class="overflow-y-auto 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" data-drawer-target="drawer-bottom-example" data-drawer-show="drawer-bottom-example" data-drawer-placement="bottom" aria-controls="drawer-bottom-example">
|
|
@@ -422,7 +408,7 @@ Use this example to show the drawer on the bottom side of the page.
|
|
|
422
408
|
</button>
|
|
423
409
|
</div>
|
|
424
410
|
</div>
|
|
425
|
-
|
|
411
|
+
```
|
|
426
412
|
|
|
427
413
|
## Body scrolling
|
|
428
414
|
|
|
@@ -432,7 +418,7 @@ By default, body scrolling is disabled when the drawer is visible, however, you
|
|
|
432
418
|
|
|
433
419
|
This is an example where the body scrolling behaviour is disabled when the drawer is visible.
|
|
434
420
|
|
|
435
|
-
|
|
421
|
+
```html
|
|
436
422
|
|
|
437
423
|
<!-- drawer init and toggle -->
|
|
438
424
|
<div class="text-center">
|
|
@@ -514,13 +500,13 @@ This is an example where the body scrolling behaviour is disabled when the drawe
|
|
|
514
500
|
</ul>
|
|
515
501
|
</div>
|
|
516
502
|
</div>
|
|
517
|
-
|
|
503
|
+
```
|
|
518
504
|
|
|
519
505
|
### Enabled
|
|
520
506
|
|
|
521
507
|
Get started with this example in order to enable body scrolling even if the drawer component is visible by using the `data-drawer-body-scrolling="false"` data attribute.
|
|
522
508
|
|
|
523
|
-
|
|
509
|
+
```html
|
|
524
510
|
|
|
525
511
|
<!-- drawer init and toggle -->
|
|
526
512
|
<div class="text-center">
|
|
@@ -602,7 +588,7 @@ Get started with this example in order to enable body scrolling even if the draw
|
|
|
602
588
|
</ul>
|
|
603
589
|
</div>
|
|
604
590
|
</div>
|
|
605
|
-
|
|
591
|
+
```
|
|
606
592
|
|
|
607
593
|
## Backdrop
|
|
608
594
|
|
|
@@ -614,7 +600,7 @@ Use the `data-drawer-backdrop="{true|false}"` data attribute where you can disab
|
|
|
614
600
|
|
|
615
601
|
Use this example to enable the backdrop element by default.
|
|
616
602
|
|
|
617
|
-
|
|
603
|
+
```html
|
|
618
604
|
|
|
619
605
|
<!-- drawer init and toggle -->
|
|
620
606
|
<div class="text-center">
|
|
@@ -696,13 +682,13 @@ Use this example to enable the backdrop element by default.
|
|
|
696
682
|
</ul>
|
|
697
683
|
</div>
|
|
698
684
|
</div>
|
|
699
|
-
|
|
685
|
+
```
|
|
700
686
|
|
|
701
687
|
### Disabled
|
|
702
688
|
|
|
703
689
|
Use the `data-drawer-backdrop="false"` data attribute to disable the backdrop element when the drawer is shown.
|
|
704
690
|
|
|
705
|
-
|
|
691
|
+
```html
|
|
706
692
|
|
|
707
693
|
<!-- drawer init and toggle -->
|
|
708
694
|
<div class="text-center">
|
|
@@ -784,7 +770,7 @@ Use the `data-drawer-backdrop="false"` data attribute to disable the backdrop el
|
|
|
784
770
|
</ul>
|
|
785
771
|
</div>
|
|
786
772
|
</div>
|
|
787
|
-
|
|
773
|
+
```
|
|
788
774
|
|
|
789
775
|
## Swipeable edge
|
|
790
776
|
|
|
@@ -794,7 +780,7 @@ In this example we also use the `data-drawer-toggle="id"` option to toggle the v
|
|
|
794
780
|
|
|
795
781
|
Use the `data-drawer-edge-offset="bottom-[*px]"` data attribute where you can apply a class from Tailwind CSS to set the offset. Default value is `bottom-[60px]`.
|
|
796
782
|
|
|
797
|
-
|
|
783
|
+
```html
|
|
798
784
|
|
|
799
785
|
<!-- drawer init and toggle -->
|
|
800
786
|
<div class="text-center">
|
|
@@ -863,7 +849,7 @@ Use the `data-drawer-edge-offset="bottom-[*px]"` data attribute where you can ap
|
|
|
863
849
|
</div>
|
|
864
850
|
</div>
|
|
865
851
|
</div>
|
|
866
|
-
|
|
852
|
+
```
|
|
867
853
|
|
|
868
854
|
## More examples
|
|
869
855
|
|
|
@@ -1153,7 +1139,7 @@ Check out the following JavaScript example to learn how to initialize, set the o
|
|
|
1153
1139
|
|
|
1154
1140
|
First of all, create a new JavaScript element object for the first parameter of the Drawer object and another options object to set the placement, backdrop settings, and callback functions.
|
|
1155
1141
|
|
|
1156
|
-
|
|
1142
|
+
```javascript
|
|
1157
1143
|
// set the drawer menu element
|
|
1158
1144
|
const $targetEl = document.getElementById('drawer-js-example');
|
|
1159
1145
|
|
|
@@ -1182,11 +1168,11 @@ const instanceOptions = {
|
|
|
1182
1168
|
id: 'drawer-js-example',
|
|
1183
1169
|
override: true
|
|
1184
1170
|
};
|
|
1185
|
-
|
|
1171
|
+
```
|
|
1186
1172
|
|
|
1187
1173
|
Initialize the Drawer positioning by creating a new object:
|
|
1188
1174
|
|
|
1189
|
-
|
|
1175
|
+
```javascript
|
|
1190
1176
|
import { Drawer } from 'flowbite';
|
|
1191
1177
|
|
|
1192
1178
|
/*
|
|
@@ -1195,37 +1181,37 @@ import { Drawer } from 'flowbite';
|
|
|
1195
1181
|
* instanceOptions (optional)
|
|
1196
1182
|
*/
|
|
1197
1183
|
const drawer = new Drawer($targetEl, options, instanceOptions);
|
|
1198
|
-
|
|
1184
|
+
```
|
|
1199
1185
|
|
|
1200
1186
|
Use the `show` and `hide` methods to show and hide the drawer component directly from JavaScript.
|
|
1201
1187
|
|
|
1202
|
-
|
|
1188
|
+
```javascript
|
|
1203
1189
|
// show the drawer
|
|
1204
1190
|
drawer.show();
|
|
1205
1191
|
|
|
1206
1192
|
// hide the drawer
|
|
1207
1193
|
drawer.hide();
|
|
1208
|
-
|
|
1194
|
+
```
|
|
1209
1195
|
|
|
1210
1196
|
Use the `toggle` method to toggle the visibility of the drawer.
|
|
1211
1197
|
|
|
1212
|
-
|
|
1198
|
+
```javascript
|
|
1213
1199
|
// toggle the drawer
|
|
1214
1200
|
drawer.toggle();
|
|
1215
|
-
|
|
1201
|
+
```
|
|
1216
1202
|
|
|
1217
1203
|
Use the `isVisible` method to check the visibility of the drawer:
|
|
1218
1204
|
|
|
1219
|
-
|
|
1205
|
+
```javascript
|
|
1220
1206
|
// true or false
|
|
1221
1207
|
drawer.isVisible();
|
|
1222
|
-
|
|
1208
|
+
```
|
|
1223
1209
|
|
|
1224
1210
|
### HTML Markup
|
|
1225
1211
|
|
|
1226
1212
|
Use the following HTML code for the JavaScript example above.
|
|
1227
1213
|
|
|
1228
|
-
|
|
1214
|
+
```html
|
|
1229
1215
|
<!-- drawer component -->
|
|
1230
1216
|
<div id="drawer-js-example" class="fixed top-0 left-0 z-40 h-screen p-4 overflow-y-auto transition-transform -translate-x-full bg-neutral-primary-soft border-e border-default w-80" tabindex="-1" aria-labelledby="drawer-js-example">
|
|
1231
1217
|
<div class="border-b border-default pb-4 flex items-center">
|
|
@@ -1299,15 +1285,15 @@ Use the following HTML code for the JavaScript example above.
|
|
|
1299
1285
|
</ul>
|
|
1300
1286
|
</div>
|
|
1301
1287
|
</div>
|
|
1302
|
-
|
|
1288
|
+
```
|
|
1303
1289
|
|
|
1304
1290
|
### TypeScript
|
|
1305
1291
|
|
|
1306
|
-
If you're using the
|
|
1292
|
+
If you're using the TypeScript configuration from Flowbite then you can import the types for the Drawer (off-canvas) class, parameters and its options.
|
|
1307
1293
|
|
|
1308
1294
|
Here's an example that applies the types from Flowbite to the code above:
|
|
1309
1295
|
|
|
1310
|
-
|
|
1296
|
+
```typescript
|
|
1311
1297
|
import { Drawer } from 'flowbite';
|
|
1312
1298
|
import type { DrawerOptions, DrawerInterface } from 'flowbite';
|
|
1313
1299
|
import type { InstanceOptions } from 'flowbite';
|
|
@@ -1350,4 +1336,4 @@ const drawer: DrawerInterface = new Drawer($targetEl, options, instanceOptions);
|
|
|
1350
1336
|
|
|
1351
1337
|
// show the drawer
|
|
1352
1338
|
drawer.show();
|
|
1353
|
-
|
|
1339
|
+
```
|