diff --git a/README.md b/README.md index d58a502ee..ca1b126f5 100644 --- a/README.md +++ b/README.md @@ -94,13 +94,13 @@ The quickest way to get started working with Flowbite is to simply include the C Require the following minified stylesheet inside the `head` tag: ```html - + ``` And include the following javascript file before the end of the `body` tag: ```html - + ``` ### Bundled JavaScript diff --git a/config.yml b/config.yml index bfc60922e..8e0060dbb 100644 --- a/config.yml +++ b/config.yml @@ -5,7 +5,7 @@ enableInlineShortcodes: true params: homepage: "https://flowbite.com" - current_version: 2.1.1 + current_version: 2.2.0 authors: Themesberg social_image_path: /docs/images/og-image.png diff --git a/content/components/banner.md b/content/components/banner.md index 5267f1a24..5c0807935 100644 --- a/content/components/banner.md +++ b/content/components/banner.md @@ -112,7 +112,7 @@ This example can be used to encourage your website visitors to sign up to your e
-
+ diff --git a/content/components/drawer.md b/content/components/drawer.md index 8ad679b28..e22be7e84 100644 --- a/content/components/drawer.md +++ b/content/components/drawer.md @@ -200,7 +200,7 @@ Use this example to show a contact form inside the drawer component. Close menu - +
@@ -248,7 +248,7 @@ Use this example if you want to add form elements inside the drawer component in Close menu - +
diff --git a/content/components/dropdowns.md b/content/components/dropdowns.md index d10be358f..a97857a9f 100644 --- a/content/components/dropdowns.md +++ b/content/components/dropdowns.md @@ -916,7 +916,7 @@ You can also use the dropdown element inside a navigation bar and add a second l diff --git a/content/components/forms.md b/content/components/forms.md index e71da162f..6a69e00de 100644 --- a/content/components/forms.md +++ b/content/components/forms.md @@ -20,16 +20,16 @@ This is an example of a form component including an email, password, checkbox, a {{< example id="default-form-example" github="components/forms.md" show_dark=true >}} - -
+ +
-
+
-
+
@@ -49,35 +49,35 @@ Use these form elements inspired by material design from Google to adjust the `l {{< example id="form-floating-label-example" github="components/forms.md" show_dark=true >}} - -
+ +
-
+
-
+
-
+
-
+
-
+
-
+
@@ -91,19 +91,20 @@ Use these form elements inspired by material design from Google to adjust the `l Use the following utility classes to create three different sizing options (large, base, and small) for your form input elements. {{< example id="form-sizes-example" github="components/forms.md" show_dark=true >}} - -
- - -
-
- - -
-
- - -
+ +
+ + +
+
+ + +
+
+ + +
+ {{< /example >}} ## Disabled inputs @@ -111,8 +112,10 @@ Use the following utility classes to create three different sizing options (larg Use the following utility classes to indicate a disabled form input item. {{< example id="form-disabled-example" github="components/forms.md" show_dark=true >}} - - +
+ + +
{{< /example >}} ## Shadow inputs @@ -121,20 +124,20 @@ Alternatively, you can decide to apply a shadow styling using the `shadow-sm` cl {{< example id="form-shadow-example" github="components/forms.md" show_dark=true >}} -
-
+ +
-
+
-
+
-
+
@@ -149,10 +152,12 @@ Alternatively, you can decide to apply a shadow styling using the `shadow-sm` cl Use the following markup to also add a helper text below your form input item. Usually used for newsletter signup elements. {{< example id="form-helper-text-example" github="components/forms.md" show_dark=true >}} - - + + + -

We’ll never share your details. Read our Privacy Policy.

+

We’ll never share your details. Read our Privacy Policy.

+ {{< /example >}} ## Input element with icon @@ -160,16 +165,18 @@ Use the following markup to also add a helper text below your form input item. U Use the following Tailwind utility classes and [SVG icon](https://flowbite.com/icons/) to add an icon inside input form elements. {{< example id="form-input-icon-example" github="components/forms.md" show_dark=true >}} - -
-
- +
+ +
+
+ +
+
- -
+ {{< /example >}} ## Input element with addon @@ -177,15 +184,17 @@ Use the following Tailwind utility classes and [SVG icon](https://flowbite.com/i Use this example to add a SVG icon or special character with an addon style to the input element. {{< example id="form-input-addon-example" github="components/forms.md" show_dark=true >}} - -
- - - - -
+
+ +
+ + + + +
+
{{< /example >}} ## Form validation @@ -193,17 +202,18 @@ Use this example to add a SVG icon or special character with an addon style to t Use the following two success and error styles when validation your forms. {{< example id="form-validation-example" github="components/forms.md" show_dark=true >}} - -
- - -

Alright! Username available!

-
-
- - -

Oops! Username already taken!

-
+
+
+ + +

Alright! Username available!

+
+
+ + +

Oops! Username already taken!

+
+
{{< /example >}} ## Textarea @@ -211,8 +221,10 @@ Use the following two success and error styles when validation your forms. Use the following code to create a textarea form element. {{< example id="form-textarea-example" github="components/forms.md" show_dark=true >}} - - +
+ + +
{{< /example >}} ## Select input @@ -220,14 +232,16 @@ Use the following code to create a textarea form element. Use the following select input element to show selectable list of items. {{< example id="form-select-input-example" github="components/forms.md" show_dark=true >}} - - +
+ + +
{{< /example >}} ## Checkbox @@ -326,9 +340,11 @@ Group a series of buttons together on a single line or stack them in a vertical Use the following Tailwind CSS file upload element to receive any type of file from users. {{< example id="form-file-input-example" github="components/forms.md" show_dark=true >}} - - -
A profile picture is useful to confirm your are logged into your account
+
+ + +
A profile picture is useful to confirm your are logged into your account
+
{{< /example >}} ## Toggle Switch diff --git a/content/components/modal.md b/content/components/modal.md index c000adb29..921e50a5d 100644 --- a/content/components/modal.md +++ b/content/components/modal.md @@ -237,7 +237,7 @@ Use this example of a modal to use within CRUD (Create, Read, Update, Delete) op
-
+
diff --git a/content/components/navbar.md b/content/components/navbar.md index 151a5d54e..c5b35b58d 100644 --- a/content/components/navbar.md +++ b/content/components/navbar.md @@ -96,7 +96,7 @@ This example can be used to show a secondary dropdown menu when clicking on one
@@ -144,7 +144,7 @@ Use this example to show multiple layers of dropdown menu by stacking them insid @@ -789,7 +789,7 @@ Use the object parameters from the Collapse object to set the trigger element, t ### Options -Use these optional options for the Dismiss object to set the transition, duration, and timing function types based on the utility classes from Tailwind CSS. +Use these optional options for the Collapse object to set the transition, duration, and timing function types based on the utility classes from Tailwind CSS.
diff --git a/content/components/tables.md b/content/components/tables.md index 4b93569a7..fb307a84d 100644 --- a/content/components/tables.md +++ b/content/components/tables.md @@ -2636,7 +2636,7 @@ Use this example to show a modal with a form where you can edit table data by cl
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Parameter + + Type + + Required + + Description +
+ targetEl + + Element + + Required + + Pass the target input field element that will be incremented or decremented based on click event. +
+ incrementEl + + Element + + Optional + + Pass the increment button element that will increase the value of the target element based on click event. +
+ decrementEl + + Element + + Optional + + Pass the decrement button element that will decrease the value of the target element based on click event. +
+ options + + Object + + Optional + + Set these options to set the minimum and maximum value of the input field and the callback functions. +
+ instanceOptions + + Object + + Optional + + Object of options that allows you to set a custom ID for the instance that is being added to the Instance Manager and whether to override or not an existing instance. +
+
+ +### Options + +Use these optional options for the InputCounter object to set the minimum and maximum values of the input field and also to set callback functions for the increment and decrement events. + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Option + + Type + + Description +
+ minValue + + Integer + + Set the minimum value of the input field. +
+ maxValue + + Integer + + Set the maximum value of the input field. +
+ onIncrement + + Function + + Set a callback function when the item has been incremented. +
+ onDecrement + + Function + + Set a callback function when the item has been decremented. +
+
+ +### Methods + +Use the following methods of the InputCounter object to programmatically manipulate the behaviour of the input field. + +
+ + + + + + + + + + + + + + + + + + + + + +
+ Method + + Description +
+ getCurrentValue() + + Use this method to get the current value of the input field. +
+ increment() + + Use this method on the InputCounter object to increment the value of the input field. +
+ decrement() + + Use this method on the InputCounter object to decrement the value of the input field. +
+
+ +### Example + +Check out the following examples to learn how to create a new InputCounter object and how to set it up with custom options and programmatically use the methods available. + +First of all, you need to set the object parameters where the target element is required and the other two are optional. + +```javascript +// set the target element of the input field +const $targetEl = document.getElementById('counter-input-example'); + +// optionally set the increment and decrement elements +const $incrementEl = document.getElementById('increment-button'); + +const $decrementEl = document.getElementById('decrement-button'); + +// optional options with default values and callback functions +const options = { + minValue: 0, + maxValue: null, // infinite + onIncrement: () => { + console.log('input field value has been incremented'); + }, + onDecrement: () => { + console.log('input field value has been decremented'); + } +}; + +const instanceOptions = { + id: 'counter-input-example', + override: true +}; +``` + +Next step is to create a new instance of a InputCounter object using the parameters we have set above. + +```javascript +import { InputCounter } from 'flowbite'; + +/* + * $targetEl: required + * $incrementEl: optional + * $decrementEl: optional + * options: optional + */ +const counterInput = new InputCounter($targetEl, $incrementEl, $decrementEl, options, instanceOptions); +``` + +Now you can programmatically increment or decrement the input field using the methods of the InputCounter object. + +```javascript +// get the current value of the input field +counterInput.getCurrentValue(); + +// increment the value of the input field +counterInput.increment(); + +// decrement the value of the input field +counterInput.decrement(); +``` + +### HTML Markup + +Here is an example of the HTML markup that you can use for the JavaScript example above. + +```html +
+ +
+ + + +
+
+``` + +### TypeScript + +If you're using the }}">TypeScript configuration from Flowbite then you can import the types for the InputCounter object, parameters and its options. + +Here's an example that applies the types from Flowbite to the code above: + +```javascript +import { InputCounter } from 'flowbite'; +import type { InputCounterOptions, InputCounterInterface } from 'flowbite'; +import type { InstanceOptions } from 'flowbite'; + +// set the target element of the input field +const $targetEl: HTMLInputElement = document.getElementById('counter-input-example') as HTMLInputElement; + +// optionally set the increment and decrement elements +const $incrementEl: HTMLElement = document.getElementById('increment-button'); + +const $decrementEl: HTMLElement = document.getElementById('decrement-button'); + +// optional options with default values and callback functions +const options: InputCounterOptions = { + minValue: 0, + maxValue: null, // infinite + onIncrement: () => { + console.log('input field value has been incremented'); + }, + onDecrement: () => { + console.log('input field value has been decremented'); + } +}; + +// instance options object +const instanceOptions: InstanceOptions = { + id: 'counter-input-example', + override: true +}; + +/* + * $targetEl: required + * $incrementEl: optional + * $decrementEl: optional + * options: optional + * instanceOptions: optional + */ +const counterInput: InputCounterInterface = new InputCounter( + $targetEl, + $incrementEl, + $decrementEl, + options, + instanceOptions +); + +// increment the value of the input field +counterInput.increment(); + +// decrement the value of the input field +counterInput.decrement(); +``` diff --git a/content/forms/range.md b/content/forms/range.md index a5caadf3b..350a76294 100644 --- a/content/forms/range.md +++ b/content/forms/range.md @@ -65,4 +65,19 @@ Apply the small, default, and large sizes for the range component by applying th -{{< /example >}} \ No newline at end of file +{{< /example >}} + +## Labels + +Use the following example to add labels to each value milestone of the range slider component. + +{{< example id="range-labels-example" github="forms/range.md" show_dark=true >}} +
+ + + Min ($100) + $500 + $1000 + Max ($1500) +
+{{< /example >}} diff --git a/content/forms/search-input.md b/content/forms/search-input.md index d7ea22a73..ef91b0bc0 100644 --- a/content/forms/search-input.md +++ b/content/forms/search-input.md @@ -7,8 +7,8 @@ toc: true previous: File Input previousLink: forms/file-input/ -next: Select -nextLink: forms/select/ +next: Number Input +nextLink: forms/number-input/ --- The search input component can be used to let your users search through your website using string queries and it comes in multiple styles, variants, and sizes built with the utility classes from Tailwind CSS. @@ -122,7 +122,7 @@ Use this example where you can select a country in which you want to search for