Button

Quasar has a component called QBtn which is a button with a few extra useful features. For instance, it comes in two shapes: rectangle (default) and round. It also has the material ripple effect baked in (which can be disabled).

The button component also comes with a spinner or loading effect. You would use this for times when app execution may cause a delay and you want to give the user some feedback about that delay. When used, the button will display a spinning animation as soon as the user clicks the button.

When not disabled or spinning, QBtn emits a @click event, as soon as it is clicked or tapped.

Installation


// quasar.conf.js

return {
  framework: {
    components: [
      'QBtn'
    ]
  }
}

Usage

Standard buttons



Custom colors



With icons



Round buttons



Custom content



Design

Button design



Button alignment



Button size



Some button actions involve contacting a server, so an asynchronous response. It’s best that you inform the user about a background process taking place until the asynchronous response is ready. QBtn offers this possibility through the loading prop. This property will display a QSpinner (by default) instead of the icon and/or label of the button. Custom loading content can also be used (not only text or spinners).

Indeterminate progress



Should you wish, you can also display a deterministic progress within the button by using the additional percentage property along with what you’ve already learned about buttons with progress:

Deterministic progress



More options

Custom ripple



The example below won’t work with UMD version (so in Codepen/jsFiddle too) because it relies on the existence of Vue Router.




Other options



Disable



Controlling the button for form submission

When you have a button to submit a form’s input to the server, like a “Save” button, more often than not you will also want to give the user the ability to submit the form with a press of the ENTER key. If you would also like to give the user feedback of the saving process being in progress, and to prevent the user repeatedly pressing the button, you would need the button to show a loading spinner and be disabled from click events. QBtn allows this behavior if configured so.

Form Submission



QBtn API