Skip to content
Advertisement

Dialog and overlay size with vuetify 3

This is my dialog code:

JavaScript

As you see the width of the dialog is 500 <v-dialog width="500">. And this is the result I get:

enter image description here

As you see grey overlay width is also 500px. Is this correct? I expected that grey overlay width will be 100%, but dialog with with=500px will be in the center of the screen. Is it possible to set their sizes with <v-dialog> attributes or I should modify css rules?

Advertisement

Answer

There are some difference in dialog layout between Vuetify 3 and Vuetify 2. The below images is taken from example in their docs.

Vuetify 2:

Vuetify 2

Vuetify 3:

Vuetify 3

As you can see, in Vuetify 2 the overlay is an independent element and width: 500px added to the dialog while in Vuetify 3, the overlay contains dialog content and width: 500px added to the overlay. That causes the result you get. I’m not sure it’s expected behavior or not because Vuetify 3 is still in alpha version but for now, you can get your expected result by moving width="500" from v-dialog to v-card in your code.

Codepen

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement