Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vuetify 2 toolbar ans 1 navigation drawer with 1 toolbar above the navigation drawer

I'm trying to achieve something like this : image

Actually i have this : enter image description here

My problem is that currently I can not put the first toolbar above the navigation drawer.

<template>
  <v-app>
    <v-toolbar app class="elevation-1">
        <span>Toolbar1</span>
    </v-toolbar>

    <v-toolbar app class="mt-5 elevation-1" style="top: 16px">
      <span>Toolbar2</span>
    </v-toolbar>

    <v-navigation-drawer app fixed permanent>
      <v-toolbar></v-toolbar>
      <v-toolbar flat>
        <v-list>
          <v-list-tile>
            <v-list-tile-title class="title">Filter</v-list-tile-title>
          </v-list-tile>
        </v-list>
      </v-toolbar>
    </v-navigation-drawer>

    <v-content class="mt-5">
      <HomePage/>
    </v-content>
  </v-app>
</template>
like image 971
filol Avatar asked Apr 26 '19 12:04

filol


2 Answers

I just answerd another similar question, despite I did it wrong first time, I think I redeemed myself on the edit, here

Anyhow, I was wanting to do the same, so I changed the v-content to v-main, for the actual content. Also, used the app, permanent and clipped, without the fixed prop. The app navbar also should have clipped-right in your case. That did the trick for me

<v-app-bar
app
clipped-left
color="#c4161c"
dark
>
...
</v-app-bar>

...

<v-navigation-drawer
app
permanent        
clipped
class="mt-100"        
>
...
</v-navigation-drawer>
like image 112
Rafael Karosuo Avatar answered Oct 31 '22 03:10

Rafael Karosuo


I would first add clipped-left to the first toolbar and move it under the navigation-drawer like so.

<template>
  <v-app>
    <v-navigation-drawer app fixed permanent>
      <v-toolbar></v-toolbar>
      <v-toolbar flat>
        <v-list>
          <v-list-tile>
            <v-list-tile-title class="title">Filter</v-list-tile-title>
          </v-list-tile>
        </v-list>
      </v-toolbar>
    </v-navigation-drawer>

    <v-toolbar app clipped-left class="elevation-1">
      <span>Toolbar1</span>
    </v-toolbar>

    <v-toolbar app class="mt-5 elevation-1" style="top: 16px">
      <span>Toolbar2</span>
    </v-toolbar>

    <v-content class="mt-5">
      <HomePage/>
    </v-content>
  </v-app>
</template>

Though, I strongly advice you to get familiar with the available props on the Vuetify documentation (regarding those 2 components) to be able to get exactly what you want

  • Navigation Drawer
  • Toolbar

Update

I did some ugly fixes to the previous answer to handle the responsiveness and clean the code a bit.

<template>
  <v-app>
    <v-navigation-drawer clipped permanent app>
      <v-list>
        <v-list-tile>
          <v-list-tile-title class="title">Menu Item #1</v-list-tile-title>
        </v-list-tile>
      </v-list>
    </v-navigation-drawer>

    <v-toolbar clipped-left app>
      <span>Toolbar</span>
    </v-toolbar>

    <v-toolbar class="mt-5" :style="$vuetify.breakpoint.smAndDown ? 'top: 8px' : 'top: 16px'" app>
      <span>SubToolbar</span>
    </v-toolbar>

    <v-content :style="$vuetify.breakpoint.smAndDown ? 'padding-top: 112px' : 'padding-top: 128px'">
      <v-container fluid>
        Content
        <!-- <router-view></router-view> -->
      </v-container>
    </v-content>
  </v-app>
</template>
like image 12
Cédric M. Avatar answered Oct 31 '22 02:10

Cédric M.