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.
Files changed (72) hide show
  1. package/README.md +49 -74
  2. package/build/index.js +20 -36
  3. package/data/components/accordion.md +39 -53
  4. package/data/components/alerts.md +27 -44
  5. package/data/components/avatar.md +20 -33
  6. package/data/components/badge.md +34 -47
  7. package/data/components/banner.md +10 -29
  8. package/data/components/bottom-navigation.md +16 -29
  9. package/data/components/breadcrumb.md +12 -25
  10. package/data/components/button-group.md +26 -39
  11. package/data/components/buttons.md +41 -67
  12. package/data/components/card.md +34 -47
  13. package/data/components/carousel.md +25 -39
  14. package/data/components/chat-bubble.md +36 -50
  15. package/data/components/clipboard.md +256 -252
  16. package/data/components/datepicker.md +56 -70
  17. package/data/components/device-mockups.md +16 -29
  18. package/data/components/drawer.md +42 -56
  19. package/data/components/dropdowns.md +66 -80
  20. package/data/components/footer.md +16 -29
  21. package/data/components/forms.md +32 -50
  22. package/data/components/gallery.md +16 -33
  23. package/data/components/indicators.md +18 -31
  24. package/data/components/jumbotron.md +12 -25
  25. package/data/components/kbd.md +14 -27
  26. package/data/components/list-group.md +14 -27
  27. package/data/components/mega-menu.md +10 -24
  28. package/data/components/modal.md +37 -51
  29. package/data/components/navbar.md +41 -55
  30. package/data/components/pagination.md +22 -35
  31. package/data/components/popover.md +36 -51
  32. package/data/components/progress.md +10 -23
  33. package/data/components/qr-code.md +41 -133
  34. package/data/components/rating.md +16 -29
  35. package/data/components/sidebar.md +15 -30
  36. package/data/components/skeleton.md +16 -29
  37. package/data/components/speed-dial.md +40 -55
  38. package/data/components/spinner.md +14 -27
  39. package/data/components/stepper.md +14 -27
  40. package/data/components/tables.md +45 -64
  41. package/data/components/tabs.md +30 -45
  42. package/data/components/timeline.md +10 -23
  43. package/data/components/toast.md +25 -39
  44. package/data/components/tooltips.md +24 -39
  45. package/data/components/typography.md +22 -35
  46. package/data/components/video.md +14 -27
  47. package/data/forms/checkbox.md +27 -43
  48. package/data/forms/file-input.md +12 -26
  49. package/data/forms/floating-label.md +12 -25
  50. package/data/forms/input-field.md +17 -32
  51. package/data/forms/number-input.md +83 -93
  52. package/data/forms/phone-input.md +42 -54
  53. package/data/forms/radio.md +23 -39
  54. package/data/forms/range.md +12 -26
  55. package/data/forms/search-input.md +14 -31
  56. package/data/forms/select.md +15 -30
  57. package/data/forms/textarea.md +8 -21
  58. package/data/forms/timepicker.md +30 -42
  59. package/data/forms/toggle.md +18 -31
  60. package/data/plugins/charts.md +542 -526
  61. package/data/plugins/datatables.md +285 -286
  62. package/data/plugins/wysiwyg.md +658 -650
  63. package/data/quickstart.md +24 -24
  64. package/data/typography/blockquote.md +24 -37
  65. package/data/typography/headings.md +30 -43
  66. package/data/typography/hr.md +10 -23
  67. package/data/typography/images.md +32 -45
  68. package/data/typography/links.md +16 -29
  69. package/data/typography/lists.md +22 -35
  70. package/data/typography/paragraphs.md +30 -43
  71. package/data/typography/text.md +42 -55
  72. package/package.json +1 -1
@@ -1,17 +1,3 @@
1
- ---
2
- layout: docs
3
- title: Tailwind CSS Number Input - Flowbite
4
- description: Use the number input component to set a numeric value inside a form field based on multiple styles, variants, and layouts that can be used in product pages, forms, and more
5
- group: forms
6
- requires_js: true
7
- toc: true
8
-
9
- previous: Search Input
10
- previousLink: forms/search-input/
11
- next: Phone Input
12
- nextLink: forms/phone-input/
13
- ---
14
-
15
1
  The number input component from Flowbite can be used to introduce numeric values inside a form such as for a quantity field, a ZIP code, a phone number, your credit card number, and more. All of the UI components are coded exclusively with Tailwind CSS.
16
2
 
17
3
  The examples on this page have basic functionality coded with JavaScript and the quantity input has a more advanced ability to increment and decrement the value with the help of the `data-input-counter` attribute from the Flowbite JS API.
@@ -20,18 +6,18 @@ The examples on this page have basic functionality coded with JavaScript and the
20
6
 
21
7
  Use this component to set a number value inside a form field by applying the `type="number"` attribute.
22
8
 
23
- {{< example github="components/number-input.md" show_dark=true >}}
9
+ ```html
24
10
  <form class="max-w-sm mx-auto">
25
11
  <label for="number-input" class="block mb-2.5 text-sm font-medium text-heading">Select a number:</label>
26
12
  <input type="number" id="number-input" aria-describedby="helper-text-explanation" 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 shadow-xs placeholder:text-body" placeholder="90210" required />
27
13
  </form>
28
- {{< /example >}}
14
+ ```
29
15
 
30
16
  ## ZIP code input
31
17
 
32
18
  Use this example with an icon and helper text to set a ZIP code value inside a form field by also applying the `pattern` attribute to validate the input using a regular expression for a 5 digit number.
33
19
 
34
- {{< example github="components/number-input.md" show_dark=true >}}
20
+ ```html
35
21
  <form class="max-w-sm mx-auto">
36
22
  <label for="zip-input" class="block mb-2.5 text-sm font-medium text-heading">ZIP code:</label>
37
23
  <div class="relative">
@@ -42,13 +28,13 @@ Use this example with an icon and helper text to set a ZIP code value inside a f
42
28
  </div>
43
29
  <p id="helper-text-explanation" class="mt-2.5 text-sm text-body">Please select a 5 digit number from 0 to 9.</p>
44
30
  </form>
45
- {{< /example >}}
31
+ ```
46
32
 
47
33
  ## Phone number
48
34
 
49
35
  Use this example to set a phone number inside a form field based on the `type="phone"` attribute and a dropdown menu to select the country code.
50
36
 
51
- {{< example github="components/number-input.md" show_dark=true iframeHeight="360" >}}
37
+ ```html
52
38
  <form class="max-w-sm mx-auto">
53
39
  <div class="flex items-center -space-x-px shadow-xs rounded-base">
54
40
  <button id="dropdown-phone-button" data-dropdown-toggle="dropdown-phone" type="button" class="inline-flex items-center shrink-0 z-10 text-body bg-neutral-secondary-medium box-border border border-default-medium hover:bg-neutral-tertiary-medium hover:text-fg-brand focus:ring-4 focus:ring-neutral-tertiary font-medium leading-5 rounded-s-base text-sm px-4 py-2.5 focus:outline-none">
@@ -148,7 +134,7 @@ Use this example to set a phone number inside a form field based on the `type="p
148
134
  </div>
149
135
  </div>
150
136
  </form>
151
- {{< /example >}}
137
+ ```
152
138
 
153
139
  ## Control buttons
154
140
 
@@ -160,7 +146,7 @@ If you have the [Flowbite JS](https://flowbite.com/docs/getting-started/quicksta
160
146
  - `data-input-counter-increment` - increment the value of the input field
161
147
  - `data-input-counter-decrement` - decrement the value of the input field
162
148
 
163
- {{< example github="components/number-input.md" show_dark=true >}}
149
+ ```html
164
150
  <form class="max-w-xs mx-auto">
165
151
  <label for="quantity-input" class="block mb-2.5 text-sm font-medium text-heading">Choose quantity:</label>
166
152
  <div class="relative flex items-center max-w-[9rem] shadow-xs rounded-base">
@@ -174,13 +160,13 @@ If you have the [Flowbite JS](https://flowbite.com/docs/getting-started/quicksta
174
160
  </div>
175
161
  <p id="helper-text-explanation" class="mt-2.5 text-sm text-body shrink-0">Please select a 5 digit number from 0 to 9.</p>
176
162
  </form>
177
- {{< /example >}}
163
+ ```
178
164
 
179
165
  ## Control buttons with icon
180
166
 
181
167
  Use this example to also add an icon inside the input field to improve the user experience.
182
168
 
183
- {{< example github="components/number-input.md" show_dark=true >}}
169
+ ```html
184
170
  <form class="max-w-xs mx-auto">
185
171
  <label for="bedrooms-input" class="block mb-2.5 text-sm font-medium text-heading">Choose quantity:</label>
186
172
  <div class="relative flex items-center max-w-[11rem] shadow-xs rounded-base">
@@ -198,13 +184,13 @@ Use this example to also add an icon inside the input field to improve the user
198
184
  </div>
199
185
  <p id="helper-text-explanation" class="mt-2.5 text-sm text-body">Please select the number of bedrooms.</p>
200
186
  </form>
201
- {{< /example >}}
187
+ ```
202
188
 
203
189
  ## Counter input
204
190
 
205
191
  Use this example as an alternative style to the control buttons example above.
206
192
 
207
- {{< example github="components/number-input.md" show_dark=true >}}
193
+ ```html
208
194
  <form class="max-w-xs mx-auto">
209
195
  <label for="counter-input" class="block mb-1.5 text-sm font-medium text-heading">Choose quantity:</label>
210
196
  <div class="relative flex items-center">
@@ -217,13 +203,13 @@ Use this example as an alternative style to the control buttons example above.
217
203
  </button>
218
204
  </div>
219
205
  </form>
220
- {{< /example >}}
206
+ ```
221
207
 
222
208
  ## Currency input
223
209
 
224
210
  This component can be used to set a currency value inside a form field when you need to set a price.
225
211
 
226
- {{< example github="components/number-input.md" show_dark=true iframeHeight="290" >}}
212
+ ```html
227
213
  <form class="max-w-[18rem] mx-auto flex shadow-xs rounded-base -space-x-px">
228
214
  <label for="currency-input" class="mb-2.5 text-sm font-medium text-heading sr-only">Your Email</label>
229
215
  <div class="relative w-full">
@@ -296,13 +282,13 @@ This component can be used to set a currency value inside a form field when you
296
282
  </ul>
297
283
  </div>
298
284
  </form>
299
- {{< /example >}}
285
+ ```
300
286
 
301
287
  ## Credit card input
302
288
 
303
289
  Use this component to set the information needed when making an online transaction with a credit card by adding the card number, expiration date, and security code. The component uses the [Flowbite Datepicker](https://flowbite.com/docs/components/datepicker/).
304
290
 
305
- {{< example github="components/number-input.md" show_dark=true iframeHeight="340" >}}
291
+ ```html
306
292
  <form class="max-w-sm mx-auto">
307
293
  <label for="card-number-input" class="sr-only">Card number:</label>
308
294
  <div class="relative">
@@ -326,13 +312,45 @@ Use this component to set the information needed when making an online transacti
326
312
  </div>
327
313
  <button type="submit" 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">Pay now</button>
328
314
  </form>
329
- {{< /example >}}
315
+ ```
330
316
 
331
317
  ## Pin code input
332
318
 
333
319
  Use this example of a pin code input to set a 6 digit code. This can be used when setting up a new account or when making a payment and the code is sent via phone or email.
334
320
 
335
- {{< example github="components/number-input.md" show_dark=true javascript=`
321
+ ```html
322
+ <form class="max-w-sm mx-auto">
323
+ <div class="flex mb-2 space-x-2 rtl:space-x-reverse">
324
+ <div>
325
+ <label for="code-1" class="sr-only">First code</label>
326
+ <input type="text" maxlength="1" data-focus-input-init data-focus-input-next="code-2" id="code-1" class="block bg-neutral-secondary-medium border border-default-medium text-heading text-sm rounded-base focus:ring-brand focus:border-brand h-10 w-10 shadow-xs placeholder:text-body" required />
327
+ </div>
328
+ <div>
329
+ <label for="code-2" class="sr-only">Second code</label>
330
+ <input type="text" maxlength="1" data-focus-input-init data-focus-input-prev="code-1" data-focus-input-next="code-3" id="code-2" class="block bg-neutral-secondary-medium border border-default-medium text-heading text-sm rounded-base focus:ring-brand focus:border-brand h-10 w-10 shadow-xs placeholder:text-body" required />
331
+ </div>
332
+ <div>
333
+ <label for="code-3" class="sr-only">Third code</label>
334
+ <input type="text" maxlength="1" data-focus-input-init data-focus-input-prev="code-2" data-focus-input-next="code-4" id="code-3" class="block bg-neutral-secondary-medium border border-default-medium text-heading text-sm rounded-base focus:ring-brand focus:border-brand h-10 w-10 shadow-xs placeholder:text-body" required />
335
+ </div>
336
+ <div>
337
+ <label for="code-4" class="sr-only">Fourth code</label>
338
+ <input type="text" maxlength="1" data-focus-input-init data-focus-input-prev="code-3" data-focus-input-next="code-5" id="code-4" class="block bg-neutral-secondary-medium border border-default-medium text-heading text-sm rounded-base focus:ring-brand focus:border-brand h-10 w-10 shadow-xs placeholder:text-body" required />
339
+ </div>
340
+ <div>
341
+ <label for="code-5" class="sr-only">Fifth code</label>
342
+ <input type="text" maxlength="1" data-focus-input-init data-focus-input-prev="code-4" data-focus-input-next="code-6" id="code-5" class="block bg-neutral-secondary-medium border border-default-medium text-heading text-sm rounded-base focus:ring-brand focus:border-brand h-10 w-10 shadow-xs placeholder:text-body" required />
343
+ </div>
344
+ <div>
345
+ <label for="code-6" class="sr-only">Sixth code</label>
346
+ <input type="text" maxlength="1" data-focus-input-init data-focus-input-prev="code-5" id="code-6" class="block bg-neutral-secondary-medium border border-default-medium text-heading text-sm rounded-base focus:ring-brand focus:border-brand h-10 w-10 shadow-xs placeholder:text-body" required />
347
+ </div>
348
+ </div>
349
+ <p id="helper-text-explanation" class="mt-2.5 text-sm text-body">Please introduce the 6 digit code we sent via email.</p>
350
+ </form>
351
+ ```
352
+
353
+ ```javascript
336
354
  // use this simple function to automatically focus on the next input
337
355
  function focusNextInput(el, prevId, nextId) {
338
356
  if (el.value.length === 0) {
@@ -375,55 +393,13 @@ document.querySelectorAll('[data-focus-input-init]').forEach(function(element) {
375
393
  });
376
394
  });
377
395
  });
378
- ` >}}
379
- <form class="max-w-sm mx-auto">
380
- <div class="flex mb-2 space-x-2 rtl:space-x-reverse">
381
- <div>
382
- <label for="code-1" class="sr-only">First code</label>
383
- <input type="text" maxlength="1" data-focus-input-init data-focus-input-next="code-2" id="code-1" class="block bg-neutral-secondary-medium border border-default-medium text-heading text-sm rounded-base focus:ring-brand focus:border-brand h-10 w-10 shadow-xs placeholder:text-body" required />
384
- </div>
385
- <div>
386
- <label for="code-2" class="sr-only">Second code</label>
387
- <input type="text" maxlength="1" data-focus-input-init data-focus-input-prev="code-1" data-focus-input-next="code-3" id="code-2" class="block bg-neutral-secondary-medium border border-default-medium text-heading text-sm rounded-base focus:ring-brand focus:border-brand h-10 w-10 shadow-xs placeholder:text-body" required />
388
- </div>
389
- <div>
390
- <label for="code-3" class="sr-only">Third code</label>
391
- <input type="text" maxlength="1" data-focus-input-init data-focus-input-prev="code-2" data-focus-input-next="code-4" id="code-3" class="block bg-neutral-secondary-medium border border-default-medium text-heading text-sm rounded-base focus:ring-brand focus:border-brand h-10 w-10 shadow-xs placeholder:text-body" required />
392
- </div>
393
- <div>
394
- <label for="code-4" class="sr-only">Fourth code</label>
395
- <input type="text" maxlength="1" data-focus-input-init data-focus-input-prev="code-3" data-focus-input-next="code-5" id="code-4" class="block bg-neutral-secondary-medium border border-default-medium text-heading text-sm rounded-base focus:ring-brand focus:border-brand h-10 w-10 shadow-xs placeholder:text-body" required />
396
- </div>
397
- <div>
398
- <label for="code-5" class="sr-only">Fifth code</label>
399
- <input type="text" maxlength="1" data-focus-input-init data-focus-input-prev="code-4" data-focus-input-next="code-6" id="code-5" class="block bg-neutral-secondary-medium border border-default-medium text-heading text-sm rounded-base focus:ring-brand focus:border-brand h-10 w-10 shadow-xs placeholder:text-body" required />
400
- </div>
401
- <div>
402
- <label for="code-6" class="sr-only">Sixth code</label>
403
- <input type="text" maxlength="1" data-focus-input-init data-focus-input-prev="code-5" id="code-6" class="block bg-neutral-secondary-medium border border-default-medium text-heading text-sm rounded-base focus:ring-brand focus:border-brand h-10 w-10 shadow-xs placeholder:text-body" required />
404
- </div>
405
- </div>
406
- <p id="helper-text-explanation" class="mt-2.5 text-sm text-body">Please introduce the 6 digit code we sent via email.</p>
407
- </form>
408
- {{< /example >}}
396
+ ```
409
397
 
410
398
  ## Number input with slider
411
399
 
412
400
  This example can be used to set the value of a number input field by sliding the range slider component or by typing the value in the input field. The component uses the [Flowbite Range Slider](https://flowbite.com/docs/components/range-slider/).
413
401
 
414
- {{< example github="components/number-input.md" show_dark=true iframeHeight="290" disable_init_js="true" javascript=`
415
- // Get the elements
416
- var rangeInput = document.getElementById('price-range-input');
417
- var currencyInput = document.getElementById('currency-input');
418
-
419
- // Function to update the currency input
420
- function updateCurrencyInput() {
421
- currencyInput.value = rangeInput.value;
422
- }
423
-
424
- // Add event listener to the range input
425
- rangeInput.addEventListener('input', updateCurrencyInput);
426
- ` >}}
402
+ ```html
427
403
  <form class="max-w-[24rem] mx-auto">
428
404
  <div class="flex shadow-xs rounded-base -space-x-px mb-4">
429
405
  <label for="currency-input-2" class="mb-2.5 text-sm font-medium text-heading sr-only">Your Email</label>
@@ -506,13 +482,27 @@ rangeInput.addEventListener('input', updateCurrencyInput);
506
482
  <span class="text-sm text-body absolute end-0 -bottom-6">Max ($1500)</span>
507
483
  </div>
508
484
  </form>
509
- {{< /example >}}
485
+ ```
486
+
487
+ ```javascript
488
+ // Get the elements
489
+ var rangeInput = document.getElementById('price-range-input');
490
+ var currencyInput = document.getElementById('currency-input');
491
+
492
+ // Function to update the currency input
493
+ function updateCurrencyInput() {
494
+ currencyInput.value = rangeInput.value;
495
+ }
496
+
497
+ // Add event listener to the range input
498
+ rangeInput.addEventListener('input', updateCurrencyInput);
499
+ ```
510
500
 
511
501
  ## Convert currency
512
502
 
513
503
  Use this example of two number input fields and dropdowns to convert currency and even from fiat to crypto.
514
504
 
515
- {{< example github="components/number-input.md" show_dark=true iframeHeight="290" disable_init_js="true" >}}
505
+ ```html
516
506
  <form class="max-w-xl mx-auto">
517
507
  <div class="space-x-0 space-y-4 sm:space-y-0 sm:space-x-4 rtl:space-x-reverse flex items-center flex-col sm:flex-row mb-4">
518
508
  <div class="flex -space-x-px">
@@ -642,13 +632,13 @@ Use this example of two number input fields and dropdowns to convert currency an
642
632
  </button>
643
633
  </div>
644
634
  </form>
645
- {{< /example >}}
635
+ ```
646
636
 
647
637
  ## Advanced control buttons
648
638
 
649
639
  This example can be used to add multiple number input fields with quantity selectors and control buttons to use for E-commerce UI similar to projects like AirBnb or Booking.
650
640
 
651
- {{< example github="components/number-input.md" show_dark=true >}}
641
+ ```html
652
642
  <form class="max-w-xs mx-auto">
653
643
  <label for="bedrooms-input" class="sr-only">Choose bedrooms number:</label>
654
644
  <div class="relative flex items-center mb-2">
@@ -699,7 +689,7 @@ This example can be used to add multiple number input fields with quantity selec
699
689
  </button>
700
690
  </div>
701
691
  </form>
702
- {{< /example >}}
692
+ ```
703
693
 
704
694
  ## Min and max values
705
695
 
@@ -710,7 +700,7 @@ By using the InputCounter object from the Flowbite JS API, you ca set the min an
710
700
 
711
701
  These values will be enforced and validated whenever the user clicks on one of the buttons or tries to introduce the value manually.
712
702
 
713
- {{< example github="components/number-input.md" show_dark=true >}}
703
+ ```html
714
704
  <form class="max-w-xs mx-auto">
715
705
  <label for="quantity-input" class="block mb-2.5 text-sm font-medium text-heading">Choose quantity:</label>
716
706
  <div class="relative flex items-center max-w-[8rem]">
@@ -724,7 +714,7 @@ These values will be enforced and validated whenever the user clicks on one of t
724
714
  </div>
725
715
  <p id="helper-text-explanation" class="mt-2.5 text-sm text-body">Please select a 5 digit number from 0 to 9.</p>
726
716
  </form>
727
- {{< /example >}}
717
+ ```
728
718
 
729
719
  ## JavaScript behaviour
730
720
 
@@ -962,7 +952,7 @@ Check out the following examples to learn how to create a new InputCounter objec
962
952
 
963
953
  First of all, you need to set the object parameters where the target element is required and the other two are optional.
964
954
 
965
- {{< code lang="javascript" file="number-input.js" icon="file" >}}
955
+ ```javascript
966
956
  // set the target element of the input field
967
957
  const $targetEl = document.getElementById('counter-input-example');
968
958
 
@@ -987,11 +977,11 @@ const instanceOptions = {
987
977
  id: 'counter-input-example',
988
978
  override: true
989
979
  };
990
- {{< /code >}}
980
+ ```
991
981
 
992
982
  Next step is to create a new instance of a InputCounter object using the parameters we have set above.
993
983
 
994
- {{< code lang="javascript" file="number-input.js" icon="file" >}}
984
+ ```javascript
995
985
  import { InputCounter } from 'flowbite';
996
986
 
997
987
  /*
@@ -1001,11 +991,11 @@ import { InputCounter } from 'flowbite';
1001
991
  * options: optional
1002
992
  */
1003
993
  const counterInput = new InputCounter($targetEl, $incrementEl, $decrementEl, options, instanceOptions);
1004
- {{< /code >}}
994
+ ```
1005
995
 
1006
996
  Now you can programmatically increment or decrement the input field using the methods of the InputCounter object.
1007
997
 
1008
- {{< code lang="javascript" >}}
998
+ ```javascript
1009
999
  // get the current value of the input field
1010
1000
  counterInput.getCurrentValue();
1011
1001
 
@@ -1014,13 +1004,13 @@ counterInput.increment();
1014
1004
 
1015
1005
  // decrement the value of the input field
1016
1006
  counterInput.decrement();
1017
- {{< /code >}}
1007
+ ```
1018
1008
 
1019
1009
  ### HTML Markup
1020
1010
 
1021
1011
  Here is an example of the HTML markup that you can use for the JavaScript example above.
1022
1012
 
1023
- {{< code lang="html" file="number-input.html" icon="file" >}}
1013
+ ```html
1024
1014
  <form class="max-w-xs mx-auto">
1025
1015
  <label for="counter-input-example" class="block mb-1 text-sm font-medium text-gray-900 dark:text-white">Choose quantity:</label>
1026
1016
  <div class="relative flex items-center">
@@ -1037,15 +1027,15 @@ Here is an example of the HTML markup that you can use for the JavaScript exampl
1037
1027
  </button>
1038
1028
  </div>
1039
1029
  </form>
1040
- {{< /code >}}
1030
+ ```
1041
1031
 
1042
1032
  ### TypeScript
1043
1033
 
1044
- If you're using the <a href="{{< ref "getting-started/typescript" >}}">TypeScript configuration</a> from Flowbite then you can import the types for the InputCounter object, parameters and its options.
1034
+ If you're using the TypeScript configuration from Flowbite then you can import the types for the InputCounter object, parameters and its options.
1045
1035
 
1046
1036
  Here's an example that applies the types from Flowbite to the code above:
1047
1037
 
1048
- {{< code lang="typescript" file="number-input.ts" icon="file" >}}
1038
+ ```html
1049
1039
  import { InputCounter } from 'flowbite';
1050
1040
  import type { InputCounterOptions, InputCounterInterface } from 'flowbite';
1051
1041
  import type { InstanceOptions } from 'flowbite';
@@ -1096,4 +1086,4 @@ counterInput.increment();
1096
1086
 
1097
1087
  // decrement the value of the input field
1098
1088
  counterInput.decrement();
1099
- {{< /code >}}
1089
+ ```
@@ -1,17 +1,3 @@
1
- ---
2
- layout: docs
3
- title: Tailwind CSS Phone Input - Flowbite
4
- description: Use the phone number input component from Flowbite to set a phone number inside a form field and use a dropdown menu to select the country code based on various styles, sizes and colors
5
- group: forms
6
- requires_js: true
7
- toc: true
8
-
9
- previous: Number Input
10
- previousLink: forms/number-input/
11
- next: Select
12
- nextLink: forms/select/
13
- ---
14
-
15
1
  The phone number input component from Flowbite can be used to set a phone number inside a form field by using the native `type="tel"` attribute and also use a dropdown menu to select the country code.
16
2
 
17
3
  The examples are built with the utility classes from Tailwind CSS and they are fully responsive, dark mode compatible and support RTL layouts and can be used for any type of web project.
@@ -20,7 +6,7 @@ The examples are built with the utility classes from Tailwind CSS and they are f
20
6
 
21
7
  Use this component to set a phone number inside an input field by setting the `type="tel"` attribute.
22
8
 
23
- {{< example github="components/phone-input.md" show_dark=true >}}
9
+ ```html
24
10
  <form class="max-w-sm mx-auto">
25
11
  <label for="phone-input" class="block mb-2.5 text-sm font-medium text-heading">Phone number:</label>
26
12
  <div class="relative">
@@ -31,13 +17,13 @@ Use this component to set a phone number inside an input field by setting the `t
31
17
  </div>
32
18
  <p id="helper-text-explanation" class="mt-2.5 text-sm text-body">Select a phone number that matches the format.</p>
33
19
  </form>
34
- {{< /example >}}
20
+ ```
35
21
 
36
22
  ## Phone input country code
37
23
 
38
24
  This example can be used to select the country code from a dropdown menu and set the phone number inside an input field and use the `pattern` attribute to validate the phone number.
39
25
 
40
- {{< example github="components/phone-input.md" show_dark=true iframeHeight="360" >}}
26
+ ```html
41
27
 
42
28
  <form class="max-w-sm mx-auto">
43
29
  <div class="flex items-center -space-x-px shadow-xs rounded-base">
@@ -139,13 +125,13 @@ This example can be used to select the country code from a dropdown menu and set
139
125
  </div>
140
126
  </form>
141
127
 
142
- {{< /example >}}
128
+ ```
143
129
 
144
130
  ## Floating label input
145
131
 
146
132
  Set a phone number inside an input field with a floating label inspired by Material UI from Google.
147
133
 
148
- {{< example github="forms/phone-input.md" show_dark=true >}}
134
+ ```html
149
135
  <form class="max-w-xs mx-auto">
150
136
  <div class="relative">
151
137
  <span class="absolute start-0 bottom-3 text-body">
@@ -155,13 +141,13 @@ Set a phone number inside an input field with a floating label inspired by Mater
155
141
  <label for="floating-phone-number" class="absolute text-sm text-body duration-300 transform -translate-y-6 scale-75 top-3 -z-10 origin-[0] peer-placeholder-shown:start-6 peer-focus:start-0 peer-focus:text-fg-brand peer-placeholder-shown:scale-100 peer-placeholder-shown:translate-y-0 peer-focus:scale-75 peer-focus:-translate-y-6 rtl:peer-focus:translate-x-1/4 rtl:peer-focus:left-auto">Phone number</label>
156
142
  </div>
157
143
  </form>
158
- {{< /example >}}
144
+ ```
159
145
 
160
146
  ## Verification code input
161
147
 
162
148
  Use this example to send a verification code to the user's phone number for authentication.
163
149
 
164
- {{< example github="components/phone-input.md" show_dark=true iframeHeight="360" disable_init_js="true" >}}
150
+ ```html
165
151
  <form class="max-w-sm mx-auto">
166
152
  <div class="flex items-center -space-x-px shadow-xs rounded-base">
167
153
  <button id="dropdown-phone-button-2" data-dropdown-toggle="dropdown-phone-2" type="button" class="inline-flex items-center shrink-0 z-10 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 font-medium leading-5 rounded-s-base text-sm px-4 py-2.5 focus:outline-none">
@@ -265,13 +251,41 @@ Use this example to send a verification code to the user's phone number for auth
265
251
  </form>
266
252
 
267
253
 
268
- {{< /example >}}
254
+ ```
269
255
 
270
256
  ## Phone number select
271
257
 
272
258
  Use this example to select one of your saved phone numbers from an application with a copy-paste feature.
273
259
 
274
- {{< example github="components/phone-input.md" show_dark=true disable_init_js="true" javascript=`
260
+ ```html
261
+ <form class="max-w-sm mx-auto">
262
+ <div class="mb-2.5 flex justify-between items-center">
263
+ <label for="phone-numbers" class="text-sm font-medium text-heading">Primary phone number:</label>
264
+ <a href="#" class="text-fg-brand text-xs font-medium hover:underline">Manage numbers</a>
265
+ </div>
266
+ <div class="flex items-center shadow-xs rounded-base">
267
+ <div class="relative w-full">
268
+ <select id="phone-numbers" aria-describedby="helper-text-explanation" class="bg-neutral-secondary-medium border border-default-medium text-heading text-sm rounded-s-base border-e-0 focus:ring-brand focus:border-brand block w-full px-3 py-2.5 placeholder:text-body">
269
+ <option selected value="+1 234 456 7890">+1 234 456 7890</option>
270
+ <option value="+1 456 234 7890">+1 456 234 7890</option>
271
+ <option value="+1 432 621 3163">+1 432 621 3163</option>
272
+ </select>
273
+ </div>
274
+ <button id="copy-number" data-copy-to-clipboard-target="phone-numbers" data-tooltip-target="tooltip-phone" class="shrink-0 z-10 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 font-medium leading-5 rounded-e-base text-sm px-4 h-[42px] focus:outline-none" type="button">
275
+ <svg id="copy-icon" class="w-4 h-4" 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 4h3a1 1 0 0 1 1 1v15a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h3m0 3h6m-6 5h6m-6 4h6M10 3v4h4V3h-4Z"/></svg>
276
+ <svg id="copy-icon-success" class="w-4 h-4 hidden" 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 4h3a1 1 0 0 1 1 1v15a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h3m0 3h6m-6 7 2 2 4-4m-5-9v4h4V3h-4Z"/></svg>
277
+ </button>
278
+ <div id="tooltip-phone" role="tooltip" class="absolute z-10 invisible inline-block px-3 py-2 text-sm font-medium text-white transition-opacity duration-300 bg-dark rounded-lg shadow-xs opacity-0 tooltip">
279
+ <span id="tooltip-text">Copy number</span>
280
+ <span id="tooltip-text-success" class="hidden">Copied!</span>
281
+ <div class="tooltip-arrow" data-popper-arrow></div>
282
+ </div>
283
+ </div>
284
+ <p id="helper-text-explanation" class="mt-2.5 text-sm text-body">Please set your primary phone number.</p>
285
+ </form>
286
+ ```
287
+
288
+ ```javascript
275
289
  window.addEventListener('load', function() {
276
290
  const clipboard = FlowbiteInstances.getInstance('CopyClipboard', 'phone-numbers');
277
291
  const tooltip = FlowbiteInstances.getInstance('Tooltip', 'tooltip-phone');
@@ -307,39 +321,13 @@ window.addEventListener('load', function() {
307
321
  tooltip.hide();
308
322
  }
309
323
  });
310
- ` >}}
311
- <form class="max-w-sm mx-auto">
312
- <div class="mb-2.5 flex justify-between items-center">
313
- <label for="phone-numbers" class="text-sm font-medium text-heading">Primary phone number:</label>
314
- <a href="#" class="text-fg-brand text-xs font-medium hover:underline">Manage numbers</a>
315
- </div>
316
- <div class="flex items-center shadow-xs rounded-base">
317
- <div class="relative w-full">
318
- <select id="phone-numbers" aria-describedby="helper-text-explanation" class="bg-neutral-secondary-medium border border-default-medium text-heading text-sm rounded-s-base border-e-0 focus:ring-brand focus:border-brand block w-full px-3 py-2.5 placeholder:text-body">
319
- <option selected value="+1 234 456 7890">+1 234 456 7890</option>
320
- <option value="+1 456 234 7890">+1 456 234 7890</option>
321
- <option value="+1 432 621 3163">+1 432 621 3163</option>
322
- </select>
323
- </div>
324
- <button id="copy-number" data-copy-to-clipboard-target="phone-numbers" data-tooltip-target="tooltip-phone" class="shrink-0 z-10 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 font-medium leading-5 rounded-e-base text-sm px-4 h-[42px] focus:outline-none" type="button">
325
- <svg id="copy-icon" class="w-4 h-4" 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 4h3a1 1 0 0 1 1 1v15a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h3m0 3h6m-6 5h6m-6 4h6M10 3v4h4V3h-4Z"/></svg>
326
- <svg id="copy-icon-success" class="w-4 h-4 hidden" 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 4h3a1 1 0 0 1 1 1v15a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h3m0 3h6m-6 7 2 2 4-4m-5-9v4h4V3h-4Z"/></svg>
327
- </button>
328
- <div id="tooltip-phone" role="tooltip" class="absolute z-10 invisible inline-block px-3 py-2 text-sm font-medium text-white transition-opacity duration-300 bg-dark rounded-lg shadow-xs opacity-0 tooltip">
329
- <span id="tooltip-text">Copy number</span>
330
- <span id="tooltip-text-success" class="hidden">Copied!</span>
331
- <div class="tooltip-arrow" data-popper-arrow></div>
332
- </div>
333
- </div>
334
- <p id="helper-text-explanation" class="mt-2.5 text-sm text-body">Please set your primary phone number.</p>
335
- </form>
336
- {{< /example >}}
324
+ ```
337
325
 
338
326
  ## Authentication form
339
327
 
340
328
  Use this example to authenticate users with a login form using a phone number instead of an email address.
341
329
 
342
- {{< example github="components/phone-input.md" show_dark=true iframeHeight="390" disable_init_js="true" >}}
330
+ ```html
343
331
  <form class="max-w-sm mx-auto">
344
332
  <label for="dropdown-phone-3" class="block mb-2.5 text-sm font-medium text-heading">Phone number</label>
345
333
  <div class="flex items-center -space-x-px shadow-xs rounded-base">
@@ -449,13 +437,13 @@ Use this example to authenticate users with a login form using a phone number in
449
437
  </div>
450
438
  <button type="submit" class="w-full 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">Sign Up</button>
451
439
  </form>
452
- {{< /example >}}
440
+ ```
453
441
 
454
442
  ## Advanced phone verification
455
443
 
456
444
  Use this example to verify a phone number via SMS or phone call using a dropdown component.
457
445
 
458
- {{< example github="components/phone-input.md" show_dark=true iframeHeight="360" disable_init_js="true" >}}
446
+ ```html
459
447
  <form class="max-w-sm mx-auto">
460
448
  <div class="flex items-center mt-2 shadow-xs rounded-base">
461
449
  <button id="dropdown-phone-button-4" data-dropdown-toggle="dropdown-phone-4" class="inline-flex items-center shrink-0 z-10 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 font-medium leading-5 rounded-s-base text-sm px-4 py-2.5 focus:outline-none" type="button">
@@ -574,4 +562,4 @@ Use this example to verify a phone number via SMS or phone call using a dropdown
574
562
  </div>
575
563
  <button type="submit" class="mt-4 w-full 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">Activate account</button>
576
564
  </form>
577
- {{< /example >}}
565
+ ```