Toggle

The QToggle component is another basic element for user input. You can use this for turning settings, features or true/false inputs on and off.

TIP

Please also refer to the QOptionGroup on other possibilities for creating groups of Checkboxes.

Installation


// quasar.conf.js

return {
  framework: {
    // NOT needed if using auto-import feature:
    components: [
      'QToggle'
    ]
  }
}

Usage

Basic

Use the color prop to control the toggle’s color.

Basic



With labels

With labels



Keeping color

Keep color



With icons

Icons



Custom model values

Instead of the default true/false values, you can use custom ones.

Custom model values



Array model

If you have a number of toggles for a selection, use can use an Array as the model for all of them and specify val prop on each toggle. If the toggle is ticked, its val will be inserted into the array and vice versa.

Array model



Dark and disable

On a dark background



Disabled state



With QOptionGroup

TIP

You can also use QOptionGroup, which simplifies the usage when you have groups of toggles, like in example below.

Usage with QOptionGroup



With QItem

With QItem



QToggle API