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,42 +1,28 @@
|
|
|
1
|
-
---
|
|
2
|
-
layout: docs
|
|
3
|
-
title: Tailwind CSS Datepicker - Flowbite
|
|
4
|
-
description: Start receiving date and time data from your users using this free datepicker element based on Tailwind utility-classes and vanilla JavaScript
|
|
5
|
-
group: components
|
|
6
|
-
toc: true
|
|
7
|
-
requires_js: true
|
|
8
|
-
|
|
9
|
-
previous: Clipboard
|
|
10
|
-
previousLink: components/clipboard/
|
|
11
|
-
next: Device mockups
|
|
12
|
-
nextLink: components/device-mockups/
|
|
13
|
-
---
|
|
14
|
-
|
|
15
1
|
The Tailwind CSS datepicker component developed by Flowbite is built with vanilla JavaScript and using the utility-first classes from Tailwind. The datepicker features both inline and a date range picker functionality and some extra options such as autohide, custom format, positioning, and more. Check out the [timepicker component](https://flowbite.com/docs/forms/timepicker/) to select time alongside dates.
|
|
16
2
|
|
|
17
3
|
## Getting started
|
|
18
4
|
|
|
19
5
|
If you want to use the datepicker component from Flowbite you have to include the Flowbite JavaScript file either via NPM or CDN. For versions before `2.4.0` please continue using the dedicated CDN and component.
|
|
20
6
|
|
|
21
|
-
Follow the
|
|
7
|
+
Follow the quickstart and then include the following JavaScript file:
|
|
22
8
|
|
|
23
|
-
|
|
9
|
+
```html
|
|
24
10
|
<script src="../path/to/flowbite/dist/flowbite.min.js"></script>
|
|
25
|
-
|
|
11
|
+
```
|
|
26
12
|
|
|
27
13
|
Alternatively you can also use CDN to include the datepicker JavaScript.
|
|
28
14
|
|
|
29
|
-
|
|
30
|
-
<script src="https://cdn.jsdelivr.net/npm/flowbite
|
|
31
|
-
|
|
15
|
+
```html
|
|
16
|
+
<script src="https://cdn.jsdelivr.net/npm/flowbite/dist/flowbite.min.js"></script>
|
|
17
|
+
```
|
|
32
18
|
|
|
33
19
|
Also make sure that you add the source files for Tailwind in your main CSS file:
|
|
34
20
|
|
|
35
|
-
|
|
21
|
+
```css
|
|
36
22
|
@import "tailwindcss";
|
|
37
23
|
|
|
38
24
|
@source "../node_modules/flowbite-datepicker";
|
|
39
|
-
|
|
25
|
+
```
|
|
40
26
|
|
|
41
27
|
If you'd like to manually be able to manipulate the datepicker component using JavaScript then you should <a href="#javascript">install the component using NPM</a> and include it into your JavaScript code.
|
|
42
28
|
|
|
@@ -44,28 +30,28 @@ If you'd like to manually be able to manipulate the datepicker component using J
|
|
|
44
30
|
|
|
45
31
|
Use the following example of an input element to create a datepicker component. All you need to do is to add the `datepicker` data attribute to any `input` element.
|
|
46
32
|
|
|
47
|
-
|
|
33
|
+
```html
|
|
48
34
|
<div class="relative max-w-sm">
|
|
49
35
|
<div class="absolute inset-y-0 start-0 flex items-center ps-3 pointer-events-none">
|
|
50
36
|
<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>
|
|
51
37
|
</div>
|
|
52
38
|
<input datepicker id="default-datepicker" 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="Select date">
|
|
53
39
|
</div>
|
|
54
|
-
|
|
40
|
+
```
|
|
55
41
|
|
|
56
42
|
## Inline datepicker
|
|
57
43
|
|
|
58
44
|
Use the `inline-datepicker` and `data-date` data attributes to initialize and set the default date for an inline datepicker inside a block element such as a `div`.
|
|
59
45
|
|
|
60
|
-
|
|
46
|
+
```html
|
|
61
47
|
<div id="datepicker-inline" inline-datepicker data-date="02/25/2024"></div>
|
|
62
|
-
|
|
48
|
+
```
|
|
63
49
|
|
|
64
50
|
## Date range picker
|
|
65
51
|
|
|
66
52
|
Use the `date-rangepicker` data attribute and the following markup to initialize two datepickers as a range.
|
|
67
53
|
|
|
68
|
-
|
|
54
|
+
```html
|
|
69
55
|
<div id="date-range-picker" date-rangepicker class="flex items-center">
|
|
70
56
|
<div class="relative">
|
|
71
57
|
<div class="absolute inset-y-0 start-0 flex items-center ps-3 pointer-events-none">
|
|
@@ -81,7 +67,7 @@ Use the `date-rangepicker` data attribute and the following markup to initialize
|
|
|
81
67
|
<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="Select date end">
|
|
82
68
|
</div>
|
|
83
69
|
</div>
|
|
84
|
-
|
|
70
|
+
```
|
|
85
71
|
|
|
86
72
|
## Options
|
|
87
73
|
|
|
@@ -91,14 +77,14 @@ Learn more about the options that you can use with the Tailwind datepicker to en
|
|
|
91
77
|
|
|
92
78
|
Use the `datepicker-autohide` data attribute to make the datepicker disappear right after selecting a date.
|
|
93
79
|
|
|
94
|
-
|
|
80
|
+
```html
|
|
95
81
|
<div class="relative max-w-sm">
|
|
96
82
|
<div class="absolute inset-y-0 start-0 flex items-center ps-3 pointer-events-none">
|
|
97
83
|
<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>
|
|
98
84
|
</div>
|
|
99
85
|
<input id="datepicker-autohide" datepicker datepicker-autohide 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="Select date">
|
|
100
86
|
</div>
|
|
101
|
-
|
|
87
|
+
```
|
|
102
88
|
|
|
103
89
|
### Action buttons
|
|
104
90
|
|
|
@@ -109,66 +95,66 @@ By adding the `datepicker-buttons` data attribute you will enable the `today` an
|
|
|
109
95
|
|
|
110
96
|
If you want the button to additionally select today's date, add `datepicker-autoselect-today` data attribute.
|
|
111
97
|
|
|
112
|
-
|
|
98
|
+
```html
|
|
113
99
|
<div class="relative max-w-sm">
|
|
114
100
|
<div class="absolute inset-y-0 start-0 flex items-center ps-3 pointer-events-none">
|
|
115
101
|
<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>
|
|
116
102
|
</div>
|
|
117
103
|
<input id="datepicker-actions" datepicker datepicker-buttons datepicker-autoselect-today 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="Select date">
|
|
118
104
|
</div>
|
|
119
|
-
|
|
105
|
+
```
|
|
120
106
|
|
|
121
107
|
### Date format
|
|
122
108
|
|
|
123
109
|
If you want to use a custom format such as `mm-dd-yyyy`then you can use the `datepicker-format="{format}"` data attribute to change it.
|
|
124
110
|
|
|
125
|
-
|
|
111
|
+
```html
|
|
126
112
|
<div class="relative max-w-sm">
|
|
127
113
|
<div class="absolute inset-y-0 start-0 flex items-center ps-3 pointer-events-none">
|
|
128
114
|
<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>
|
|
129
115
|
</div>
|
|
130
116
|
<input id="datepicker-format" datepicker datepicker-format="mm-dd-yyyy" 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="Select date">
|
|
131
117
|
</div>
|
|
132
|
-
|
|
118
|
+
```
|
|
133
119
|
|
|
134
120
|
### Max and min dates
|
|
135
121
|
|
|
136
122
|
Use the `datepicker-min-date={format}` and `datepicker-max-date={format}` to set the minimum and maximum dates that can be selected inside the datepicker.
|
|
137
123
|
|
|
138
|
-
|
|
124
|
+
```html
|
|
139
125
|
<div class="relative max-w-sm">
|
|
140
126
|
<div class="absolute inset-y-0 start-0 flex items-center ps-3 pointer-events-none">
|
|
141
127
|
<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>
|
|
142
128
|
</div>
|
|
143
129
|
<input id="datepicker-format" datepicker datepicker-min-date="06/04/2024" datepicker-max-date="05/05/2025" 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="Select date">
|
|
144
130
|
</div>
|
|
145
|
-
|
|
131
|
+
```
|
|
146
132
|
|
|
147
133
|
### Orientation
|
|
148
134
|
|
|
149
135
|
You can override the default positioning algorithm by using the `datepicker-orientation="{top|right|bottom|left}"` data attributes. You can even combine right with bottom or left with top.
|
|
150
136
|
|
|
151
|
-
|
|
137
|
+
```html
|
|
152
138
|
<div class="relative max-w-sm">
|
|
153
139
|
<div class="absolute inset-y-0 start-0 flex items-center ps-3 pointer-events-none">
|
|
154
140
|
<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>
|
|
155
141
|
</div>
|
|
156
142
|
<input id="datepicker-orientation" datepicker datepicker-orientation="bottom right" 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="Select date">
|
|
157
143
|
</div>
|
|
158
|
-
|
|
144
|
+
```
|
|
159
145
|
|
|
160
146
|
### Title
|
|
161
147
|
|
|
162
148
|
You can also add a title to the datepicker by using the `datepicker-title="{title}"` data attribute.
|
|
163
149
|
|
|
164
|
-
|
|
150
|
+
```html
|
|
165
151
|
<div class="relative max-w-sm">
|
|
166
152
|
<div class="absolute inset-y-0 start-0 flex items-center ps-3 pointer-events-none">
|
|
167
153
|
<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>
|
|
168
154
|
</div>
|
|
169
155
|
<input id="datepicker-title" datepicker datepicker-title="Flowbite datepicker" 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="Select date">
|
|
170
156
|
</div>
|
|
171
|
-
|
|
157
|
+
```
|
|
172
158
|
|
|
173
159
|
### Custom colors
|
|
174
160
|
|
|
@@ -184,7 +170,7 @@ Until then, please refer to this [solution from GitHub](https://github.com/theme
|
|
|
184
170
|
|
|
185
171
|
Use the native browser timepicker input field to select a time alongside the datepicker. Check out more examples on the [timepicker](https://flowbite.com/docs/forms/timepicker/) component page from Flowbite.
|
|
186
172
|
|
|
187
|
-
|
|
173
|
+
```html
|
|
188
174
|
<form class="max-w-[8rem] mx-auto">
|
|
189
175
|
<label for="time" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">Select time:</label>
|
|
190
176
|
<div class="relative">
|
|
@@ -194,11 +180,11 @@ Use the native browser timepicker input field to select a time alongside the dat
|
|
|
194
180
|
<input type="time" id="time" class="block w-full px-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" min="09:00" max="18:00" value="00:00" required />
|
|
195
181
|
</div>
|
|
196
182
|
</form>
|
|
197
|
-
|
|
183
|
+
```
|
|
198
184
|
|
|
199
185
|
## Dark mode
|
|
200
186
|
|
|
201
|
-
If you would like to enable dark mode for the datepicker please follow the
|
|
187
|
+
If you would like to enable dark mode for the datepicker please follow the dark mode guide on Flowbite and enable it either manually or by using a dark mode switcher.
|
|
202
188
|
|
|
203
189
|
## JavaScript Behaviour
|
|
204
190
|
|
|
@@ -479,7 +465,7 @@ Check out the following examples to learn how to use a basic HTML markup togethe
|
|
|
479
465
|
|
|
480
466
|
First of all, you need to select the datepicker element (it can be an input field or div for inline datepickers) and set up the options object.
|
|
481
467
|
|
|
482
|
-
|
|
468
|
+
```javascript
|
|
483
469
|
// set the target element of the input field
|
|
484
470
|
const $datepickerEl = document.getElementById('datepicker-custom');
|
|
485
471
|
|
|
@@ -503,11 +489,11 @@ const instanceOptions = {
|
|
|
503
489
|
id: 'datepicker-custom-example',
|
|
504
490
|
override: true
|
|
505
491
|
};
|
|
506
|
-
|
|
492
|
+
```
|
|
507
493
|
|
|
508
494
|
Next step is to create a new instance of a Datepicker object using the parameters we have set above.
|
|
509
495
|
|
|
510
|
-
|
|
496
|
+
```javascript
|
|
511
497
|
import { Datepicker } from 'flowbite';
|
|
512
498
|
|
|
513
499
|
/*
|
|
@@ -515,11 +501,11 @@ import { Datepicker } from 'flowbite';
|
|
|
515
501
|
* options: optional
|
|
516
502
|
*/
|
|
517
503
|
const datepicker = new Datepicker($datepickerEl, options, instanceOptions);
|
|
518
|
-
|
|
504
|
+
```
|
|
519
505
|
|
|
520
506
|
Use the following methods to show and hide the datepicker, set or get the currently selected date and get access to the instance.
|
|
521
507
|
|
|
522
|
-
|
|
508
|
+
```javascript
|
|
523
509
|
// get the currently selected date (undefined if not selected)
|
|
524
510
|
datepicker.getDate();
|
|
525
511
|
|
|
@@ -534,13 +520,13 @@ datepicker.hide();
|
|
|
534
520
|
|
|
535
521
|
// use this method to get the parent datepicker instance from https://mymth.github.io/vanillajs-datepicker/#/
|
|
536
522
|
datepicker.getDatepickerInstance();
|
|
537
|
-
|
|
523
|
+
```
|
|
538
524
|
|
|
539
525
|
### HTML Markup
|
|
540
526
|
|
|
541
527
|
Here is an example of the HTML markup that you can use for the JavaScript example above.
|
|
542
528
|
|
|
543
|
-
|
|
529
|
+
```html
|
|
544
530
|
<div class="relative max-w-sm">
|
|
545
531
|
<div class="absolute inset-y-0 start-0 flex items-center ps-3.5 pointer-events-none">
|
|
546
532
|
<svg class="w-4 h-4 text-gray-500 dark:text-gray-400" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 20 20">
|
|
@@ -549,15 +535,15 @@ Here is an example of the HTML markup that you can use for the JavaScript exampl
|
|
|
549
535
|
</div>
|
|
550
536
|
<input id="datepicker-custom" type="text" class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full ps-10 p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500" placeholder="Select date">
|
|
551
537
|
</div>
|
|
552
|
-
|
|
538
|
+
```
|
|
553
539
|
|
|
554
540
|
### TypeScript
|
|
555
541
|
|
|
556
|
-
If you're using the
|
|
542
|
+
If you're using the TypeScript configuration from Flowbite then you can import the types for the Datepicker object, parameters and its options.
|
|
557
543
|
|
|
558
544
|
Here's an example that applies the types from Flowbite to the code above:
|
|
559
545
|
|
|
560
|
-
|
|
546
|
+
```typescript
|
|
561
547
|
import { Datepicker } from 'flowbite';
|
|
562
548
|
import type { DatepickerOptions, DatepickerInterface } from 'flowbite';
|
|
563
549
|
import type { InstanceOptions } from 'flowbite';
|
|
@@ -612,45 +598,45 @@ datepicker.hide();
|
|
|
612
598
|
|
|
613
599
|
// use this method to get the parent datepicker instance from https://mymth.github.io/vanillajs-datepicker/#/
|
|
614
600
|
datepicker.getDatepickerInstance();
|
|
615
|
-
|
|
601
|
+
```
|
|
616
602
|
|
|
617
603
|
### Parent library
|
|
618
604
|
|
|
619
605
|
If you want to directly use the main Datepicker component instance you can either install it via NPM and import it or use the `getDatepickerInstance()` method using our Instance Manager to call all of the extra options and methods from the [parent plugin library](https://github.com/themesberg/flowbite-datepicker):
|
|
620
606
|
|
|
621
|
-
|
|
607
|
+
```bash
|
|
622
608
|
npm install flowbite-datepicker --save
|
|
623
|
-
|
|
609
|
+
```
|
|
624
610
|
|
|
625
611
|
After you've installed the NPM library, you will need to import the `Datepicker` module:
|
|
626
612
|
|
|
627
|
-
|
|
613
|
+
```javascript
|
|
628
614
|
import Datepicker from 'flowbite-datepicker';
|
|
629
|
-
|
|
615
|
+
```
|
|
630
616
|
|
|
631
617
|
Initialize a new element using the `Datepicker` constructor and optionally add your own options based on your needs:
|
|
632
618
|
|
|
633
|
-
|
|
619
|
+
```javascript
|
|
634
620
|
const datepickerEl = document.getElementById('datepickerId');
|
|
635
621
|
new Datepicker(datepickerEl, {
|
|
636
622
|
// options
|
|
637
623
|
});
|
|
638
|
-
|
|
624
|
+
```
|
|
639
625
|
|
|
640
626
|
If you want to use the **Tailwind Date Range Picker** you have to import the `DateRangePicker` module:
|
|
641
627
|
|
|
642
|
-
|
|
628
|
+
```javascript
|
|
643
629
|
import DateRangePicker from 'flowbite-datepicker';
|
|
644
|
-
|
|
630
|
+
```
|
|
645
631
|
|
|
646
632
|
Then in the same fashion you can initialize a date range picker component by using the `DateRangePicker` constructor:
|
|
647
633
|
|
|
648
|
-
|
|
634
|
+
```javascript
|
|
649
635
|
const dateRangePickerEl = document.getElementById('dateRangePickerId');
|
|
650
636
|
new DateRangePicker(dateRangePickerEl, {
|
|
651
637
|
// options
|
|
652
638
|
});
|
|
653
|
-
|
|
639
|
+
```
|
|
654
640
|
|
|
655
641
|
### React support
|
|
656
642
|
|
|
@@ -660,14 +646,14 @@ One of our community members built the React version of the Flowbite Datepicker
|
|
|
660
646
|
|
|
661
647
|
In order to support turbo load from Ruby on Rails 7, you have to include the `flowbite.turbo.js` file either from NPM or CDN into your project.
|
|
662
648
|
|
|
663
|
-
Follow the
|
|
649
|
+
Follow the quickstart guide and then include the following JavaScript file:
|
|
664
650
|
|
|
665
|
-
|
|
666
|
-
pin "flowbite", to: "https://cdn.jsdelivr.net/npm/flowbite
|
|
667
|
-
|
|
651
|
+
```ruby
|
|
652
|
+
pin "flowbite", to: "https://cdn.jsdelivr.net/npm/flowbite/dist/flowbite.turbo.min.js"
|
|
653
|
+
```
|
|
668
654
|
|
|
669
655
|
Don't forget to also import it inside your `application.js` file:
|
|
670
656
|
|
|
671
|
-
|
|
657
|
+
```javascript
|
|
672
658
|
import "flowbite/dist/flowbite.turbo.js";
|
|
673
|
-
|
|
659
|
+
```
|
|
@@ -1,16 +1,3 @@
|
|
|
1
|
-
---
|
|
2
|
-
layout: docs
|
|
3
|
-
title: Tailwind CSS Device Mockups - Flowbite
|
|
4
|
-
description: Use the device mockups component to add content and screenshot previews of your application inside phone and tablet frames coded with Tailwind CSS and Flowbite
|
|
5
|
-
group: components
|
|
6
|
-
toc: true
|
|
7
|
-
|
|
8
|
-
previous: Datepicker
|
|
9
|
-
previousLink: components/datepicker/
|
|
10
|
-
next: Drawer
|
|
11
|
-
nextLink: components/drawer/
|
|
12
|
-
---
|
|
13
|
-
|
|
14
1
|
The device mockup component can be used to feature a preview and screenshot of your application as if you would already use it on a mobile phone and it's a great use case for hero and CTA sections.
|
|
15
2
|
|
|
16
3
|
This component is built using only the utility classes from Tailwind CSS and has built-in dark mode support so it's easy to customize, it loads very fast and integrates perfectly with Tailwind CSS and Flowbite.
|
|
@@ -21,7 +8,7 @@ You can choose from multiple examples of mockups including phone, tablet, laptop
|
|
|
21
8
|
|
|
22
9
|
Use this example to show a standard phone mockup based on Tailwind CSS and add your app screenshot inside of it with dark mode support included.
|
|
23
10
|
|
|
24
|
-
|
|
11
|
+
```html
|
|
25
12
|
<div class="relative mx-auto border-default bg-base border-[14px] rounded-[2.5rem] h-[600px] w-[300px]">
|
|
26
13
|
<div class="h-[32px] w-[3px] bg-base absolute -start-[17px] top-[72px] rounded-s-lg"></div>
|
|
27
14
|
<div class="h-[46px] w-[3px] bg-base absolute -start-[17px] top-[124px] rounded-s-lg"></div>
|
|
@@ -32,13 +19,13 @@ Use this example to show a standard phone mockup based on Tailwind CSS and add y
|
|
|
32
19
|
<img src="https://flowbite.s3.amazonaws.com/blocks/marketing-ui/hero/mockup-1-dark.png" class="hidden dark:block w-[272px] h-[572px]" alt="">
|
|
33
20
|
</div>
|
|
34
21
|
</div>
|
|
35
|
-
|
|
22
|
+
```
|
|
36
23
|
|
|
37
24
|
## iPhone 12 mockup (iOS)
|
|
38
25
|
|
|
39
26
|
Use this example to clearly show that the preview of your application is being used on an iPhone with iOS.
|
|
40
27
|
|
|
41
|
-
|
|
28
|
+
```html
|
|
42
29
|
<div class="relative mx-auto border-default bg-base border-[14px] rounded-[2.5rem] h-[600px] w-[300px] shadow-xl">
|
|
43
30
|
<div class="w-[148px] h-[18px] bg-base top-0 rounded-b-[1rem] left-1/2 -translate-x-1/2 absolute"></div>
|
|
44
31
|
<div class="h-[46px] w-[3px] bg-base absolute -start-[17px] top-[124px] rounded-s-lg"></div>
|
|
@@ -49,13 +36,13 @@ Use this example to clearly show that the preview of your application is being u
|
|
|
49
36
|
<img src="https://flowbite.s3.amazonaws.com/blocks/marketing-ui/hero/mockup-2-dark.png" class="hidden dark:block w-[272px] h-[572px]" alt="">
|
|
50
37
|
</div>
|
|
51
38
|
</div>
|
|
52
|
-
|
|
39
|
+
```
|
|
53
40
|
|
|
54
41
|
## Google Pixel (Android)
|
|
55
42
|
|
|
56
43
|
Use this alternative phone mockup example if you want to feature previews for android gadgets.
|
|
57
44
|
|
|
58
|
-
|
|
45
|
+
```html
|
|
59
46
|
<div class="relative mx-auto border-default bg-base border-[14px] rounded-xl h-[600px] w-[300px] shadow-xl">
|
|
60
47
|
<div class="w-[148px] h-[18px] bg-base top-0 rounded-b-[1rem] left-1/2 -translate-x-1/2 absolute"></div>
|
|
61
48
|
<div class="h-[32px] w-[3px] bg-base absolute -start-[17px] top-[72px] rounded-s-lg"></div>
|
|
@@ -67,13 +54,13 @@ Use this alternative phone mockup example if you want to feature previews for an
|
|
|
67
54
|
<img src="https://flowbite.s3.amazonaws.com/blocks/marketing-ui/hero/mockup-1-dark.png" class="hidden dark:block w-[272px] h-[572px]" alt="">
|
|
68
55
|
</div>
|
|
69
56
|
</div>
|
|
70
|
-
|
|
57
|
+
```
|
|
71
58
|
|
|
72
59
|
## Tablet mockup
|
|
73
60
|
|
|
74
61
|
This component can be used to show an application preview inside of a responsive tablet mockup.
|
|
75
62
|
|
|
76
|
-
|
|
63
|
+
```html
|
|
77
64
|
<div class="relative mx-auto border-default bg-base border-[14px] rounded-[2.5rem] h-[454px] max-w-[341px] md:h-[682px] md:max-w-[512px]">
|
|
78
65
|
<div class="h-[32px] w-[3px] bg-base absolute -start-[17px] top-[72px] rounded-s-lg"></div>
|
|
79
66
|
<div class="h-[46px] w-[3px] bg-base absolute -start-[17px] top-[124px] rounded-s-lg"></div>
|
|
@@ -84,13 +71,13 @@ This component can be used to show an application preview inside of a responsive
|
|
|
84
71
|
<img src="https://flowbite.s3.amazonaws.com/docs/device-mockups/tablet-mockup-image-dark.png" class="hidden dark:block h-[426px] md:h-[654px]" alt="">
|
|
85
72
|
</div>
|
|
86
73
|
</div>
|
|
87
|
-
|
|
74
|
+
```
|
|
88
75
|
|
|
89
76
|
## Laptop mockup
|
|
90
77
|
|
|
91
78
|
This example can be used to show a screenshot of your application inside a laptop mockup.
|
|
92
79
|
|
|
93
|
-
|
|
80
|
+
```html
|
|
94
81
|
<div class="relative mx-auto border-default bg-base border-[8px] rounded-t-xl h-[172px] max-w-[301px] md:h-[294px] md:max-w-[512px]">
|
|
95
82
|
<div class="rounded-lg overflow-hidden h-[156px] md:h-[278px] bg-neutral-primary ">
|
|
96
83
|
<img src="https://flowbite.s3.amazonaws.com/docs/device-mockups/laptop-screen.png" class="dark:hidden h-[156px] md:h-[278px] w-full rounded-lg" alt="">
|
|
@@ -100,13 +87,13 @@ This example can be used to show a screenshot of your application inside a lapto
|
|
|
100
87
|
<div class="relative mx-auto bg-base rounded-b-xl rounded-t-sm h-[17px] max-w-[351px] md:h-[21px] md:max-w-[597px]">
|
|
101
88
|
<div class="absolute left-1/2 top-0 -translate-x-1/2 rounded-b-xl w-[56px] h-[5px] md:w-[96px] md:h-[8px] bg-base"></div>
|
|
102
89
|
</div>
|
|
103
|
-
|
|
90
|
+
```
|
|
104
91
|
|
|
105
92
|
## Desktop mockup
|
|
106
93
|
|
|
107
94
|
Use this example to show a preview of your application inside a desktop device such as an iMac.
|
|
108
95
|
|
|
109
|
-
|
|
96
|
+
```html
|
|
110
97
|
<div class="relative mx-auto border-default bg-base border-[16px] rounded-t-xl h-[172px] max-w-[301px] md:h-[294px] md:max-w-[512px]">
|
|
111
98
|
<div class="rounded-xl overflow-hidden h-[140px] md:h-[262px]">
|
|
112
99
|
<img src="https://flowbite.s3.amazonaws.com/docs/device-mockups/screen-image-imac.png" class="dark:hidden h-[140px] md:h-[262px] w-full rounded-xl" alt="">
|
|
@@ -115,13 +102,13 @@ Use this example to show a preview of your application inside a desktop device s
|
|
|
115
102
|
</div>
|
|
116
103
|
<div class="relative mx-auto bg-base rounded-b-xl h-[24px] max-w-[301px] md:h-[42px] md:max-w-[512px]"></div>
|
|
117
104
|
<div class="relative mx-auto bg-base rounded-b-xl h-[55px] max-w-[83px] md:h-[95px] md:max-w-[142px]"></div>
|
|
118
|
-
|
|
105
|
+
```
|
|
119
106
|
|
|
120
107
|
## Smartwatch mockup
|
|
121
108
|
|
|
122
109
|
This component can be used to showcase applications built for smartwatches.
|
|
123
110
|
|
|
124
|
-
|
|
111
|
+
```html
|
|
125
112
|
<div class="relative mx-auto bg-base rounded-t-[2.5rem] h-[63px] max-w-[133px]"></div>
|
|
126
113
|
<div class="relative mx-auto bg-base border-default border-[10px] rounded-[2.5rem] h-[213px] w-[208px]">
|
|
127
114
|
<div class="h-[41px] w-[6px] bg-base absolute -end-[16px] top-[40px] rounded-e-lg"></div>
|
|
@@ -132,13 +119,13 @@ This component can be used to showcase applications built for smartwatches.
|
|
|
132
119
|
</div>
|
|
133
120
|
</div>
|
|
134
121
|
<div class="relative mx-auto bg-base rounded-b-[2.5rem] h-[63px] max-w-[133px]"></div>
|
|
135
|
-
|
|
122
|
+
```
|
|
136
123
|
|
|
137
124
|
## Mockup colors
|
|
138
125
|
|
|
139
126
|
You can easily update the color of the mockup by changing the background color with Tailwind CSS.
|
|
140
127
|
|
|
141
|
-
|
|
128
|
+
```html
|
|
142
129
|
<div class="relative mx-auto border-default bg-base dark:bg-base border-[14px] rounded-[2.5rem] h-[600px] w-[300px]">
|
|
143
130
|
<div class="h-[32px] w-[3px] bg-base absolute -start-[17px] top-[72px] rounded-s-lg"></div>
|
|
144
131
|
<div class="h-[46px] w-[3px] bg-base absolute -start-[17px] top-[124px] rounded-s-lg"></div>
|
|
@@ -149,4 +136,4 @@ You can easily update the color of the mockup by changing the background color w
|
|
|
149
136
|
<img src="https://flowbite.s3.amazonaws.com/blocks/marketing-ui/hero/mockup-1-dark.png" class="hidden dark:block w-[272px] h-[572px]" alt="">
|
|
150
137
|
</div>
|
|
151
138
|
</div>
|
|
152
|
-
|
|
139
|
+
```
|