Removing Margins and Padding within Vuetify - vuetify.js

So I'm pretty much brand new to Vuetify and Front End development, so sorry if my question is either simple or maybe even too vague.
I'm trying to build a website with Nuxt and Vuetify, but I'm having an issue with removing the padding around the edges of the pages. I've tried using different components within Vuetify such as fluid, I've tried finding and altering the container css code (which I'm not even convinced I've actually found), I've tried just about anything I have found on Stack Overflow or on the Vuetify github, but nothing is working for me.
Does anyone have some advice on how to actually go about having the container take up the whole page instead of leaving margins and padding on the side? I've spent at least 5 hours over the past 2 days trying to figure this out. This is what I currently have.

use spacing helpers:
class="ma-0" removes margins
class="pa-0" removes padding
class="ma-0 pa-0" removes both
Note that these are also props but only for some (grid) components so for example:
<v-text-field class="pa-0"></v-text-field> will work,
and <v-text-field pa-0></v-text-field> will not work.
If in some components you can't remove spacing with these classes, then you need to target relevant elements with CSS.

Ok, so I was able to figure out what I was doing wrong.
Here
<template>
<v-app light>
<v-toolbar fixed app :clipped-left="clipped" color="deep-orange accent-3">
<v-toolbar-side-icon #click="drawer = !drawer"></v-toolbar-side-icon>
<v-toolbar-title v-text="title"></v-toolbar-title>
<v-spacer></v-spacer>
</v-toolbar>
<v-content>
<v-container >
<nuxt/>
</v-container>
</v-content>
<v-footer :fixed="fixed" app>
</v-footer>
</v-app>
So, in my source, everything is laid out in the "default.vue" page, which is here. I was trying to alter the styling in the actual page, so like in index.vue. When I took a closer look at default.vue, I saw the v-container, which I hadn't noticed before (like I said, complete beginner, so this is all pretty new to me).
I was able to add
<style>
.container{
max-width: 100vw;
padding:0px;
}
</style>
to default.vue, which corrected the issue I was dealing with. It really just came down to understanding the template in which I'm working with, and finding the correct place to override the CSS.

They also have predefined spacing helpers, ie pa-0.
https://vuetifyjs.com/en/layout/spacing

To remove paddings from cols, you can add "no-gutters" atribute to v-row:
<v-container fluid>
<v-row no-gutters>
<v-col>
...
</v-col>
</v-row>
<v-container>

One good way to handle these scenarios is to use a fluid v-container on your main Nuxt entry point like this (default layout):
<template>
<v-app>
<v-main>
<v-container fluid>
<Nuxt /> <!-- Nuxt's entry point -->
</v-container>
</v-main>
</v-app>
</template>
And now every time you need a full-width section set the container's v-col padding to zero (best is to use pa-0 or px-0 to be specific).
For example, inside my component I have:
<template>
<v-row class="image-background">
<v-col class="pa-0">
<v-container>
<v-row>
<v-col>
<h2 class="text-h2">Some Text</h2>
</v-col>
</v-row>
</v-container>
</v-col>
</v-row>
</template>
<style scoped>
.image-background {
background-image: url("/images/your-image.jpg");
background-size: cover;
background-repeat: no-repeat;
background-position: 50% 25%;
min-height: 35vh;
}
</style>
To create a full-width section add pa-0 class to it's column element (v-col).
class of .image-background simply adds an background image taking whole width of screen (since it is inside a fluid container with no padding on it's v-col parent).
Notice how I used another container (without fluid attribute) to hold it's content in a responsive manner including it's paddings and media query breakpoints.
I am using Vuetify v2.6.1 and by the way if you're on a vanilla Vue environment this is the whole structure in one piece:
<template>
<v-app>
<v-main>
<v-container fluid>
<v-row class="some-class">
<v-col class="pa-0">
<!-- everything below will take full-width -->
<!-- unless inside another normal v-container -->
<img src="/path/to/image">
<!-- wrap other content inside another v-container -->
<v-container>
<v-row>
<v-col>
<h2 class="text-h2">Some Text</h2>
</v-col>
</v-row>
</v-container>
</v-col>
</v-row>
</v-container>
</v-main>
</v-app>
</template>

Related

how can I layout my page by vuetify grid system?

I'm new on vuetify and I'm a little confused by its grid system. I think we have just a v-container tag and after that just a v-row tag. v-col is a direct child of v-row and in v-col we shouldn't have any v-row. right?
Wrong. You can nest v-rows and v-cols. The only difference is that v-col, as you mentioned yourself, must be a direct child of v-row. Otherwise you can nest v-rows inside other v-rows, or inside v-cols, or inside v-container.
Try it yourself here. Just change the v-card inside v-col to v-row with some text and see how it works.
<v-row
:align="align"
no-gutters
style="height: 150px;"
>
<v-col
v-for="n in 3"
:key="n"
>
<v-row no-gutters>Row {{n}}</v-row>
</v-col>
</v-row>

Why does v-progress-circular (v2.5.0+) no longer display

Since vuetify#2.5.0 the v-progress-circular—visible class is not applied on any progress components - meaning that just a dot is being displayed.
Is there anything I need to change from my existing pre 2.5.0 codebase to make it work?
My html code works on versions pre 2.5.0 ...
<v-progress-circular indeterminate color="muted"></v-progress-circular>
If I inspect the code, vuetify generates the following:
<div data-v-7ba5bd90="" role="progressbar" aria-valuemin="0" aria-valuemax="100" class="v-progress-circular v-progress-circular--indeterminate muted--text" style="height: 32px; width: 32px;">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="22.857142857142858 22.857142857142858 45.714285714285715 45.714285714285715" style="transform: rotate(0deg);">
<circle fill="transparent" cx="45.714285714285715" cy="45.714285714285715" r="20" stroke-width="5.714285714285714" stroke-dasharray="125.664" stroke-dashoffset="125.66370614359172px" class="v-progress-circular__overlay"></circle>
</svg>
<div class="v-progress-circular__info"></div>
</div>
As you can see, the classlist for the wrapping div should also contain
v-progress-circular--visible
But it doesn't. When I add that manually in the devtools the circular progress components spins in the expected way. Without it, it just renders as a dot.
In vuetify versions pre 2.5.0 it adds the v-progress-circular--visible class fine.
Has a bug crept in when upgrading to 2.5.0 - on the documentation site I can see the spinners spinning fine ...
It must have occurred during migration between the different versions.
When I inserted a debugger statement in the vuetify directives/intersect file
https://github.com/vuetifyjs/vuetify/blob/0eec92f0/packages/vuetify/src/directives/intersect/index.ts#L30
to see what's going on, the problem magically disappeared. Perhaps it was some sort of webpacker caching thing going on?
As a quick fix, you can simply manually add the v-progress-circular--visible class on the component. From my side work fine. Can be a workarround until this was fixed by Vuetify team.
new Vue({
el: "#app",
vuetify: new Vuetify()
});
<!-- Comment this one... -->
<link href="https://cdn.jsdelivr.net/npm/vuetify#2.5/dist/vuetify.min.css" rel="stylesheet">
<!-- ...and uncomment this one to see before 2.5 there is no bug -->
<!-- <link href="https://cdn.jsdelivr.net/npm/vuetify#2.4/dist/vuetify.min.css" rel="stylesheet"> -->
<div id="app">
<v-app>
<v-main>
<h1>Bugged one since 2.5+</h1>
<v-progress-circular
indeterminate
color="red"
></v-progress-circular>
<h1>Workaround issue for 2.5+</h1>
<v-progress-circular
indeterminate
class="v-progress-circular--visible"
color="green"
></v-progress-circular>
</v-main>
</v-app>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.6.11/vue.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vuetify/2.3.5/vuetify.min.js"></script>

How can I save order of v-cards when using vue draggable?

I designed a site using Vue, Vuetify, and implemented Draggable really late in the development of my application and used it as follows:
<draggable v-model="dragitems" class="v-card" handle=".handle">
<v-row>
<v-col>
<v-card>
<v-card-title class="text-button"><v-icon color="#8cd0ff" class="handle">mdi-drag</v-icon>Title 1</v-card-title>
</v-card>
</v-col>
</v-row>
<v-row>
<v-col>
<v-card>
<v-card-title class="text-button"><v-icon color="#8cd0ff" class="handle">mdi-drag</v-icon>Title 2</v-card-title>
</v-card>
</v-col>
</v-row>
</draggable>
This works exactly how I want for dragging around cards. There is a handle on each card and all of them response as expected; however, I am wondering how I can save the order of these cards without totally revamping my code, or if its even possible. My implementation of this doesn't seem to align with any of the Draggable documentation examples. Any ideas on how to save the order of v-cards, so they can be reloaded later in the same order?
Thanks

Element disappeared while toggle v-if and v-else with different templates in v-menu activator

While toggling two different activator templates in v-menu
<v-menu offset-y>
<template v-if="mini" v-slot:activator="{ on }">
<v-list-item v-on="on">
<v-list-item-content>
<v-list-item-title>Jane Smith</v-list-item-title>
<v-list-item-subtitle>Logged In</v-list-item-subtitle>
</v-list-item-content>
</v-list-item>
</template>
<template v-else v-slot:activator="{ on }">
<v-btn v-on="on">
Login
</v-btn>
</template>
<v-list>
<v-list-item>Position 1</v-list-item>
<v-list-item>Position 2</v-list-item>
<v-list-item>Position 3</v-list-item>
</v-list>
</v-menu>
we have each of them are disappeared after switching back.
All works only if there is an identical root element in each template.
This is for Vuetify 2.0.3
Example: https://codepen.io/anon/pen/aeyeNv
Try 'Click Me' button to toggle it.
I can't speak to why vuetify doesn't handle a different kind of child element, I haven't had a look into the source.
However if you want it to work with different root elements, you can use the mini variable as the key for the parent element (v-menu) which will re-create the component, so it won't be an issue
<v-menu offset-y :key='mini'>
...
</v-menu>
This is a bit of a hack, but it works and sometimes that's enough...

clear-icon not working in combo box in vuetify

I have created a combo box with chips using vuetify and made it deletable. I wanted to change the remove icon of the chip in the combo box, I tried using clear-icon to change them, but it is not working. I read in the documentation that the icon is applied when using clearable and the input is dirty . So I added clearable, even that didn't work. Please help!
Here is my code :
<div id="app">
<v-app id="inspire">
<v-container fluid>
<v-layout wrap>
<v-flex xs12>
<v-combobox
v-model="select"
outline
multiple
deletable-chips
chips
clearable
clear-icon="clear"
></v-combobox>
</v-flex>
</v-layout>
</v-container>
</v-app>
</div>
Here is the demo link : https://codepen.io/KousikaGanesh/pen/KbaNzX

Resources