This part of the documentation relates to premium templates built with Cruip CSS framework only. If the template you are using is built on the top of Tailwind CSS, please refer to the last part of the documentation.
Toggle buttons are checkbox input based. See the example below 👇
<label class="form-switch"><input type="checkbox" name="lights"><span class="form-switch-icon"></span><span>Lights</span></label>
For React and Vue templates we have provided a switch component to be used as in the examples below.
<Switch name="lights">Lights</Switch>
<c-switch name="lights">Lights</c-switch>
We have also included a version with a label on the left and another on the right. We used this switch for the pricing tables 👇
<label class="form-switch"><input type="checkbox" name="pricing-toggle" checked><span class="form-switch-icon"></span><span>Billed Monthly</span><span>Billed Annually</span></label>
And here is how to use it in React and Vue 👇
<Switch name="lights" rightLabel="Billed Annually">Billed Monthly</Switch>
<c-switch name="lights" right-label="Billed Annually">Billed Monthly</c-switch>
As you may notice, when the switch component has a rightLabel
(React) / right-label
(Vue) prop (and that prop is not empty), the component uses the inner content as a left label and the prop value as the right label.
Class | Description |
| Required to make a checkbox looks like a toggle switch |
Prop | Type | Default | Accepted values |
| string | - | - |
| string | - | - |
| string |
| - |
| boolean |
| - |
| boolean |
| - |
| boolean |
| - |
Prop | Type | Default | Accepted values |
| string | - | - |
| string | - | - |
| string | - | - |
| boolean |
| - |
| boolean |
| - |
| boolean |
| - |
| boolean |
| - |
| boolean |
| - |
Style is defined into 3 files:
src/assets/scss/core/elements/_forms.scss
src/assets/scss/settings/elements/_buttons-and-forms.scss
👆Use this to adjust Sass variables
src/assets/scss/theme/elements/_forms.scss
👆Use this to add custom CSS
Learn more about the Sass logic behind each template.