Button Toggle     

The QBtnToggle component is another basic element for user input, similar to QRadio but with buttons. You can use this to supply a way for the user to pick an option from multiple choices.

Works well with QField for additional functionality such as a helper, error message placeholder and many others.


Edit /quasar.conf.js:

framework: {
components: ['QBtnToggle']

Basic Usage

<!-- Three choices for the user -->
{label: 'One', value: 'one'},
{label: 'Two', value: 'two'},
{label: 'Three', value: 'three'}

Vue Properties

Supports v-model which should be binded to a String in your scope. Choosing one option (clicking/tapping on a radio) makes your v-model change to Radio’s val.

Vue PropertyTypeDescription
optionsArrayAn array of objects with value and label properties. The binary components will be created according to this array.
readonlyBooleanSet to true, to make the radio read-only.
disableBooleanSet to true, to disable the radio.
denseBooleanDense Buttons.
outlineBooleanSet true, if you want an outlined button.
flatBooleanSet true, if you want a flat button.
pushBooleanSet true, if the button should have a push effect.
roundedBooleanSet true, if the square button should have rounded corners.
glossyBooleanSet true, if the button should be glossy.
no-wrapBooleanPrevent text wrapping
no-capsBooleanSet true, if you don’t want button content/label to be transformed to uppercase letter on Material Theme.
no-rippleBooleanDisable Material Ripple. Mat theme only.
wait-for-rippleBooleanWait for ripple then before emitting @click event. Mat theme only.

Color Properties

All can take values from Quasar Color Palette.

Vue PropertyTypeDescription
colorStringColor of buttons.
text-colorStringOptional color of buttons label/icon.
toggle-colorStringColor for button representing the current selection.
toggle-text-colorStringOptional color for button label/icon representing the current selection.

Options Configuration

The options property must be an Array of Objects with this structure:

// required; the model gets this value when button is selected:
value: ...,

// include at least one of the following three props:
label: '...', // Label for button
icon: '...', // Icon for button
iconRight: '...', // Icon for button on right side

// Optional properties that override the QBtnToggle props:

Vue Events

Vue EventDescription
@inputTriggered when it gets selected.