Forms

Tailwind CSS Switch

Tailwind CSS Switch component is a custom toggle switch designed to represent binary states, such as on/off or enable/disable, with accompanying labels for clear indication.

Default Switch

A basic example of Tailwind CSS Switch component.

Label

Enhance the Tailwind CSS Switch by accompanying it with a label element, ensuring clear and accessible indication of its binary states.

Reverse

An example of using a reversed label element with the Tailwind CSS Switch component, demonstrating how to position the label element on the opposite side of the switch.

Tooltip

Utilize the Tailwind CSS Tooltip to integrate hint text into Tailwind CSS Switch, providing a well-guided form experience.
Hey, a delightful tooltip is here!

Checked

Set the checked attribute for the Tailwind CSS Switch to initialize it with a predefined value.

Disabled

Use the disabled attribute of the Tailwind CSS Switch to indicate non-interactivity, showing users that the switch cannot be toggled.

Sizes

Use the .switch-sm and .switch-lg custom classes to adjust the size of Tailwind CSS Switch, providing flexibility for different design requirements.

Source Code

The following source file manages the CSS styles of the Tailwind CSS Switch component. Upon building the assets using Webpack Build Tools , the below file is compiled and added into the dist/assets/css/styles.css bundle, making it available globally across all pages.
File Description
src/core/plugins/components/switch.js The Tailwind CSS compatible plugin written in PostCSS for applying CSS styles to the Tailwind CSS Switch component.