Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vuetify - Changing default navigation-drawer width

Apparently Vuetify has 300px as the default width for a navigation drawer.

Even if I change the initial width to be different

<v-navigation-drawer id="add-expense-menu" ... style="width: 325px">

the transform applied to hide the drawer is still 300px, so a part of it sticks out.

Is there a way to change the default width of this component?

like image 506
user2993349 Avatar asked May 09 '18 16:05

user2993349


2 Answers

Don't set the styles using inline CSS. Instead, make use of the props made available to the component, and bind your desired width to it, i.e.:

<v-navigation-drawer v-bind:width="325">

If you are familiar with shorthands, use :width="325" will work, i.e.

<v-navigation-drawer :width="325">
like image 138
Terry Avatar answered Oct 16 '22 11:10

Terry


You can pass the width as a prop directly to v-navigation-drawer as of latest versions of vuetify. This allows, fortunately, the usage of percentage too:

<v-navigation-drawer width="325"> //pixels
<v-navigation-drawer width="25%"> //percentage

You can back this up in https://vuetifyjs.com/en/components/navigation-drawers

like image 43
DieSeL Avatar answered Oct 16 '22 10:10

DieSeL