I was trying to get a responsive carousel with a working fade transition but quickly found out that if you have your height set to auto you mess up the transition (next image blinks underneath) and if you don't you lose responsiveness StackOverflow Question About this. Right now I am trying to figure a way to get both the transition (first image where image is cropped but transitions perfectly) AND the responsiveness (second image where the image is responsive and fills the div with height auto but the transition is not right) right and it has been suggested that I should wrap them and let the grid figure it out. I need a little help with this.
<v-row>
<v-col cols="1">
<v-btn icon large #click="toggle">
<v-icon>{{icon}}</v-icon>
</v-btn>
</v-col>
<v-col>
<v-slider
color="light-green"
thumb-color="light-green accent-4"
thumb-size="30"
track-color="light-green accent-4"
v-model="run"
max="2"
:tick-labels="ticksLabels"
tick-size="6"
ticks/>
</v-col>
</v-row>
<v-carousel
:cycle="playPause"
interval=3000
v-model="run"
hide-delimiter-background
show-arrows-on-hover
>
<v-carousel-item
transition="fade-transition"
reverse-transition="fade-transition"
v-for="(item,i) in items"
:key="i"
>
<v-row>
<v-spacer/>
<img width="75%" :src="item.src"/>
<v-spacer/>
</v-row>
</v-carousel-item>
</v-carousel>
<v-card>
<v-card-text>
{{ sampleText }}
</v-card-text>
</v-card>
Related
I'm building an app in Vuejs 3 w/ Vuetifyjs 3 and I'm running into the problem where the density="compact" row size between a v-checkbox and v-radio has a huge difference. Look at the image below, it is from two different v-cards, using v-lists. All the code is exactly the same, with the only difference that one uses v-radio and the other v-checkbox. How can I make force the v-checkbox to have the exact same lineheight as the v-radio? CSS hacks are acceptable.
I read in another post that I should wrap them in a v-layout but that has no effect.
Radio button code:
<v-card>
<v-card-title>
CARD TITLE GOES HERE
</v-card-title>
<v-list density="compact">
<v-list-item>
<v-sheet>
<v-row>
<v-col cols="2">
<v-layout>
<v-radio density="compact" dense inline></v-radio>
</v-layout>
</v-col>
<v-col cols="6">
{{ model.productName }
</v-col>
<v-col cols="4" class="center-content text-h7 text-red font-weight-bold">
€ {{ model.price }}
</v-col>
</v-row>
</v-sheet>
</v-list-item>
</v-list>
</v-card>
Checkbox code:
<v-card>
<v-list density="compact">
<v-list-item>
<v-sheet>
<v-row>
<v-col cols="2">
<v-layout>
<v-checkbox-btn density="compact" hide-details="true" inline></v-checkbox-btn>
</v-layout>
</v-col>
<v-col cols="6">
{{ model.productName }}
</v-col>
<v-col cols="4" class="center-content text-h7 text-red font-weight-bold">
€ {{ model.price }}
</v-col>
</v-row>
</v-sheet>
</v-list-item>
</v-list>
</v-card>
Uh, I have struggled with that too.
You can try <v-checkbox hide-details/>. A lot of the space is taken up by the message area from v-input, and setting the hide-details attribute will hide the area when there are no messages. Checkboxes will not align with inputs anymore though.
If that is not enough, you can unset the min-height from the element. This will align with v-radio (If you change css in scoped styles, you need to use the deep selector to target nested elements):
<style scoped>
.container-class :deep(.v-checkbox .v-selection-control) {
min-height: unset;
}
</style>
Here is an overview (the red bars are message areas):
I have an app with a navbar which should remain static on the left side of the screen.
On the rest of the screen there is a list of items, which can be unlimited for all I care.
The issue is, the navbar is growing to match that list and is scrolling along. I want it to be static regardless of the list's size.
App.vue file template:
<template>
<div id="app">
<v-app>
<v-row>
<navbar/>
<v-main>
<v-container class="main-container">
<my-item-list/>
</v-container>
</v-main>
</v-row>
</v-app>
</div>
</template>
This is what my Navbar component looks like:
<template>
<v-navigation-drawer v-model="drawer" :mini-variant.sync="mini" permanent>
<v-layout justify-space-between column fill-height>
<v-list>
<v-list-item class="px-2">
<v-list-item-avatar>
<v-img src="http://placekitten.com/200/300"></v-img>
</v-list-item-avatar>
</v-list-item>
<v-divider></v-divider>
<v-list-item
v-for="setting in settings.top"
:key="setting.id"
/>
</v-list>
<v-list>
<v-list-item
v-for="setting in settings.bottom"
:key="setting.id"
/>
</v-list>
</v-layout>
</v-navigation-drawer>
</template>
Here are also some screenshots of what is going on:
As you can see here I have all the item of my navbar nicely fitting in my screen, which is how I want it.
However, in the next image:
We now have so many items that it causes the screen to scroll, which is fine btw. The issue is, you can see that the navbar also stretches out to match the scrolling of the items. I would like the navbar to stay just the same as in the first image regardless of how many items are added.
The problem is using v-row to wrap the entire layout. v-row makes the layout flexbox and therefore both child items (the navbar and the main content) become the same height. Remove the v-row and instead use v-content around the main container list. Finally, use the app prop on the v-navigation-drawer...
<v-app>
<v-navigation-drawer
v-model="mainSidebarDrawer"
permanent
app
expand-on-hover
#transitionend="collapseSubItems"
>
<v-layout justify-space-between column fill-height>
<v-list>
..
</v-list>
<v-list>
..
</v-list>
</v-layout>
</v-navigation-drawer>
<v-content>
<v-main>
</v-main>
</v-content>
</v-app>
Demo
I have some problems aligning my layout. The idea is to have a single set of v-expansion-panels in the same row with a v-btn, and have both of them visually centered inside a card. I almost achieved it in this codepen: https://codepen.io/anzuj/pen/PoPPbdw with this structure:
row
/ \
col col
(panel) (btn)
Problem: v-col's minimum width creates a whitespace around the button, offcentering the card content visually. Would appreciate some help on how to either:
Make the v-col surrounding the v-btn the same width as the v-btn
Solve the layout without grid system
Big thanks for anyone thinking along!
All you have done is right, you just need to warp the <v-container> inside the <v-card-text> so that it gets a proper alignment. Also, the button in right doesn't need to have a col-2 width, it only needs a col-1 width. Since you haven't given any col width for the which wraps the button, it's taking the entire space and hence the container also. Another option is to set the width of the container using css eg: <v-container style="width:600px;">
<v-card color="grey lighten-3">
<v-card-text>
Problem: v-col with the <v-icon color="green">mdi-check</v-icon>button has min col width that off-centers the general look. How can the margins on left and right be visually equal?
<v-container> //Either give a width here style="width:600px;"
<v-row v-for="(item,i) in 5"
:key="i" class="mb-1" no-gutters justify="center">
<v-col cols="10">
<v-expansion-panels>
<v-expansion-panel>
<v-expansion-panel-header>Item</v-expansion-panel-header>
<v-expansion-panel-content>
Lorem ipsum dolor sit amet
</v-expansion-panel-content>
</v-expansion-panel>
</v-expansion-panels>
</v-col>
<v-col> //or set cols="1" here
<v-btn class="closeBtn mb-1 ml-1" width="36px">
<v-icon color="green">mdi-check</v-icon>
</v-btn>
</v-col>
</v-row>
</v-container>
</v-card-text>
</v-card>
Fixed it by calculating how much width the v-col with the button needs and applied styling in-line in the v-for loop:<v-col cols="1" style="max-width:40px">. Edited pen: https://codepen.io/anzuj/pen/KKddyzy
I'm trying to add some custom CSS to the .v-responsive__content element within the Vuetify JS card component. I've looked online and can't seem to find a slot for this, I need to set the z-index value of this element manually as I'm using a ::before on the v-card component to add a background overlay.
I'm having some troubles with targeting this, can someone help/advise?
<v-card
class="mx-auto mb-8"
max-width="375"
>
<v-img
class="white--text align-end"
height="200"
:src="source"
>
<v-card-title class="pb-0 mb-n1">Title</v-card-title>
<v-row>
<v-col cols="8">
<v-card-subtitle class="white--text text-truncate py-0">Subtitle</v-card-subtitle>
</v-col>
<v-col class="text-right">
<v-chip
class="chip-custom chip-custom--primary ma-0 mr-4 mt-n2"
color="primary"
text-color="white"
small
>
text
<v-icon right small class="ml-1">mdi-star</v-icon>
</v-chip>
</v-col>
</v-row>
</v-img>
</v-card>
You should be able to access it like this
Add custom class to vuetify component
<v-img
class="white--text align-end custom-image-class"
height="200"
:src="source">...</v-img>
Add Css (sccs syntax here)
.custom-image-class{
.v-responsive__content{
border: 1px red solid;
}
}
It looks a bit weird that you want to add html content within the v-img. If you want the image as background image I would not recommend the v-img component as it is.
I usually use inline style for z-index
I am using vuetify grid system to build a reply component. With column ratio of 1:11 for icon and reply column respectively. Below is the code for it
<v-row justify="center" class="ma-0 pa-0">
<v-col
id="vote-col"
cols="1"
class="pa-0 d-flex flex-column align-center"
>
<v-icon size="24">mdi-thumb-up</v-icon>
<span>{{ likes }}</span>
</v-col>
<v-col id="question-col" cols="10" class="pa-0">
<v-row class="ma-0 replyFont">
{{ reply }}
</v-row>
</v-col>
</v-row>
This looks fine on smaller screens. But as we go on the screen sizes above 1100px, even cols="1" becomes too wide and creates a lot of space between the icon column and the reply column as seen in the pictures below
How to fix v-col having more width than required? I know I can't go less than 1 for cols property. How you guys been handling this?
You could use cols="auto" to make the column the width of its content, and then no cols attribute on the other column to allow it to grow the remaining width.
<v-row justify="center" class="ma-0 pa-0">
<v-col id="vote-col" cols="auto" class="blue py-0 d-flex flex-column align-center">
<v-icon size="24">mdi-thumb-up</v-icon>
<span>0</span>
</v-col>
<v-col id="question-col" class="pa-0">
<v-row class="ma-0 replyFont">
...
</v-row>
</v-col>
</v-row>
Demo: https://codeply.com/p/pX7pin7b4L
Setting cols="X" will use Vuetify CSS class col-X which is defined like
.col-X {
flex: 0 0 YY%;
max-width: YY%;
}
where YY is computed as 100/12 * X where X is value pased to cols. X can be only whole number and minimum is 1.
That means minimum width of the column is 8.33333... percent
If you want something smaller (or fixed), you must apply your own style with max-width CSS attribute...