Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vuetify: How to add an avatar or an icon to the bottom of a navigation drawer

I'm trying to create a sidebar,using Vuetify, where there will be some common actions on the top and the user avatar will be on the bottom.

I'm using v-navigation-drawer and so far I've come up with this:

<template>
    <v-navigation-drawer 
        app 
        permanent
        mini-variant="true"
        class="cyan lighten-3"
    >
        <v-list>
            <!-- Timeline action -->
            <v-list-tile> 
                <v-list-tile-action>
                    <v-btn
                        flat
                        exact
                        icon 
                        color="white"
                    >     
                        <v-icon>timeline</v-icon>
                    </v-btn>              
                </v-list-tile-action>
            </v-list-tile>
            <!-- Sms action -->
            <v-list-tile> 
                <v-list-tile-action>
                    <v-btn
                        flat
                        exact
                        icon 
                        color="white"
                    >     
                        <v-icon>sms</v-icon>
                    </v-btn>              
                </v-list-tile-action>
            </v-list-tile>
            <!-- Calendar action -->
            <v-list-tile> 
                <v-list-tile-action>
                    <v-btn
                        flat
                        exact
                        icon 
                        color="white"
                    >     
                        <v-icon>calendar_today</v-icon>
                    </v-btn>              
                </v-list-tile-action>
            </v-list-tile>
            <!-- Settings Action -->
            <v-list-tile> 
                <v-list-tile-action>
                    <v-btn
                        flat
                        exact
                        icon
                        color="white"
                    >     
                        <v-icon>settings</v-icon>
                    </v-btn>              
                </v-list-tile-action>
            </v-list-tile>
        </v-list>
        <v-divider></v-divider>
        <!--This should be the avatar but I used a btn for demo purposes-->
        <v-btn
            flat
            exact
            icon
            bottom
            color="red"
        >     
            <v-icon>timeline</v-icon>
        </v-btn>              

    </v-navigation-drawer>
</template>
<!-- <script> and <style> follow after this-->

So as you can see after my v-list I've utilized a v-divider and placed the icon (or avatar) below.

The problem is that I cannot move this all the way to the bottom of the v-navigation-drawer. I tried using v-flex around the v-list and the final v-btn but to no avail.

What am I missing here?

like image 999
kingJulian Avatar asked Jan 26 '19 23:01

kingJulian


People also ask

How do I add custom icons to Vuetify?

vue Basically you have to move some Vuetify options into a file you import via the Vuetify optionsPath so that you can import Vue icon components into that Vuetify options file.

How do I use Vuetify icons?

The v-icon component provides a large set of glyphs to provide context to various aspects of your application. For a list of all available icons, visit the official Material Design Icons page. To use any of these icons simply use the mdi- prefix followed by the icon name.

What is V navigation drawer?

The v-navigation-drawer component is what your users will utilize to navigate through the application. The navigation-drawer is pre-configured to work with or without vue-router right out the box. For the purpose of display, some examples are wrapped in a v-card element.

How do I add photos to Vuetify?

We can add images with the v-img component. to add images with the v-img component. src has the URL of the image. aspect-ratio has the aspect ratio of the image.


2 Answers

You can use a slot inside your navigation drawer component like so :

<template v-slot:append>
    <div class="pa-2">
       <v-btn block>Logout</v-btn>
    </div>
 </template>
like image 132
jcoleau Avatar answered Sep 22 '22 02:09

jcoleau


Adding justify-end to the button and wrapping list and btn in v-layout with column and fill-height should do the work for you: https://codepen.io/anon/pen/daMXqp?editors=1000

  <v-layout align-center justify-space-between column fill-height>
    <v-list>
      ...
    </v-list>
    <v-btn
           justify-end
           flat
           exact
           icon
           color="green"
           ><v-icon>dashboard</v-icon></v-btn> 
  </v-layout>
like image 22
Beniamin H Avatar answered Sep 20 '22 02:09

Beniamin H