Why donate
API Explorer
Dialog

The QDialog component is a great way to offer the user the ability to choose a specific action or list of actions. They also can provide the user with important information, or require them to make a decision (or multiple decisions).

From a UI perspective, you can think of Dialogs as a type of floating modal, which covers only a portion of the screen. This means Dialogs should only be used for quick user actions, like verifying a password, getting a short App notification or selecting an option or options quickly.

TIP

Dialogs can also be used as a globally available method for more basic use cases, like the native JS alert(), prompt(), etc. For the latter behaviour, go to Dialog Plugin page.

Masterclass TIP

Rather than cluttering your .vue templates with QDialogs, it’s best if you write a component for your dialog and use the Dialog Plugin to invoke it from anywhere in your app.

Loading QDialog API...

Usage

Note

It’s best that your QDialog main content is a QCard. However, if you are planning on using any other component (like QForm) or tag, make sure that the direct child of QDialog is rendered with a <div> tag (or wrap it with one yourself).

Basic

Basic



Styling

Styling



Backdrop filter (v2.14.8+)



Positioning

Positions



TIP

Do not mistake “position” prop with the show/hide animation. If you want a custom animation, you should use transition-show and transition-hide which can be applied regardless of “position” or “maximized”.

Maximized



Various content

Dialogs can contain any content. Some examples:

Various content



With containerized QLayout



TIP

If you are going to use the containerized QLayout, you’ll need to put a width on your QDialog, if using left/right position, or a height, if using top/bottom position. You can use vw and vh units.

Handling scroll

Scrollable dialogs



Different modes

User cannot dismiss the Dialog by pressing ESCAPE key or by clicking/tapping on its backdrop.

Persistent



Dialogs can also be a part of the page, without requiring immediate focus. It’s where “seamless” mode comes into play:

Seamless



Dialog in dialog

You are able to open dialogs on top of other dialogs, with infinite number of depth levels.

Inception



Sizing

You are able to customize the size of the Dialogs. Notice we either tamper with the content’s style or we use full-width or full-height props:

Sizing examples



Cordova/Capacitor back button

Quasar handles the back button for you by default so it can hide any opened Dialogs instead of the default behavior which is to return to the previous page (which is not a nice user experience).

However, should you wish to disable this behavior, edit your /quasar.config file:


// quasar.config file
return {
  framework: {
    config: {
      capacitor: {
        // Quasar handles app exit on mobile phone back button.
        backButtonExit: true/false/'*'/['/login', '/home', '/my-page'],

        // On the other hand, the following completely
        // disables Quasar's back button management.
        backButton: true/false
      }
    }
  }
}