I am trying to use a v-card with vuetify 2.x. The card overflows on IE11 even though its max-width is set to 90%.
I imported the following in main.js for browser compatibility.
import Es6Promise from 'es6-promise';
import 'babel-polyfill';
Es6Promise.polyfill();
My card is defined in the template as follows:
<template>
<v-layout column>
<v-card class="mx-auto pa-4" max-width="90%">
<v-card-title>Test</v-card-title>
<v-card-text class="text-justify">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent
</v-card-text>
</v-card>
</v-layout>
</template>
Try to add div tag in the v-card content, then you could add <br> tag to add new line, or add CSS style (such as the word-wrap: break-word property) on the div tag to prevent content overflow.
sample code like this:
<div id="app">
<v-app id="inspire">
<v-card class="mx-auto" max-width="344" >
<v-card-text>
<div>Word of the Day</div>
<p class="display-1 text--primary">
be•nev•o•lent
</p>
<p>adjective</p>
<div class="text--primary">
well meaning and kindly.<br>
"a benevolent smile"
</div>
</v-card-text>
<v-card-actions>
<v-btn text color="deep-purple accent-4" > Learn More </v-btn>
</v-card-actions>
</v-card>
</v-app>
</div>
Related
Using an example from their official website, I'm attempting to control the width of a v-card that is being used within a timeline component. When I added max-width="400px" to the the v-card component the timeline items that render on the left side no longer align within the center as such.
<div id="app">
<v-app id="inspire">
<v-timeline
align-top
:dense="$vuetify.breakpoint.smAndDown"
>
<v-timeline-item
v-for="(item, i) in items"
:key="i"
:color="item.color"
:icon="item.icon"
fill-dot
>
<v-card
:color="item.color"
dark
max-width="400px"
>
<v-card-title class="text-h6">
Lorem Ipsum Dolor
</v-card-title>
<v-card-text class="white text--primary">
<p>Lorem ipsum dolor sit amet, no nam oblique veritus. Commune scaevola imperdiet nec ut, sed euismod convenire principes at. Est et nobis iisque percipit, an vim zril disputando voluptatibus, vix an salutandi sententiae.</p>
<v-btn
:color="item.color"
class="mx-0"
outlined
>
Button
</v-btn>
</v-card-text>
</v-card>
</v-timeline-item>
</v-timeline>
</v-app>
</div>
I'm creating app in Vue.js with Vuetify library. In app I am dispalaying v-cards, whose titles are of different length. My problem is that I want to display the all title in as many lines as needed. Instead, the title breaks off and there are "..." and only one line. How to change it?
Template:
<v-card max-width="900" class="mb-6">
<v-toolbar flat color="grey darken-2" dark>
<v-toolbar-title align="left">
{{ labels[0].key }}
</v-toolbar-title>
</v-toolbar>
<v-card-text>
<v-text-field
color="grey"
v-model="labels[0].translation"
label="Translation"
>
</v-text-field>
</v-card-text>
</v-card>
After using:
style="overflow: visible"
All text is displayed but still not multiline.
Edit:
After using p instead of v-toolbar-title:
I think you might be better off not using the toolbar at all in this case - it's been designed to have a set of fixed heights (that's why it has the short, prominent and extended prop). You have multiple alternative options, but this might be the easiest:
<v-card max-width="900" class="mb-6">
<v-card-title color="grey darken-2 white--text">
{{ labels[0].key }}
</v-card-title>
<v-card-text>
<v-text-field
color="grey"
v-model="labels[0].translation"
label="Translation"
>
</v-text-field>
</v-card-text>
</v-card>
If you specifically need the dark prop, you can wrap the title in a v-sheet instead:
<v-card max-width="900" class="mb-6">
<v-sheet dark>
<v-card-title>
{{ labels[0].key }}
</v-card-title>
</v-sheet>
<v-card-text>
<v-text-field
color="grey"
v-model="labels[0].translation"
label="Translation"
>
</v-text-field>
</v-card-text>
</v-card>
https://codepen.io/thomaskuhlmann/pen/rNyLXxL
I don't think it's possible ... I searched through Vuetify ... you can change it to ordinary p element not v-toolbar-title
I use v-toolbar but when I scroll down it get disappears. Basically I want to a sticky header.
This is my code basically.
<div id="app">
<v-app>
<v-toolbar dense>
<v-toolbar-side-icon></v-toolbar-side-icon>
<v-toolbar-title>Title</v-toolbar-title>
<v-spacer></v-spacer>
<v-toolbar-items class="hidden-sm-and-down">
<v-btn flat>Link One</v-btn>
<v-btn flat>Link Two</v-btn>
<v-btn flat>Link Three</v-btn>
</v-toolbar-items>
</v-toolbar>
<main>
<h1 v-for="n in 20" :key="n">{{n}}</h1>
</main>
</v-app>
</div>
Edit: Vuetify version 1.5:
You just need to add fixed to your v-toolbar which fixes the position, So:
<v-toolbar dense fixed>
You can see the documentation here
Version 2.0.0
Change from vuetify version 1.5 :
v-app-bar: Brand new component that was created to better scope the functionality of v-toolbar. All existing scrolling techniques and app functionality from v-toolbar has been moved. New scrolling techniques such as collapsing bar, scroll shrink and more have been added.
<v-app-bar fixed> would fix the toolbar. Documentation
Try this code.
<v-app id="inspire">
<div
class="hide-overflow"
style="position: relative;"
>
<v-toolbar
color="teal lighten-3"
dark
scroll-off-screen
scroll-target="#scrolling-techniques"
dense
>
<v-toolbar-side-icon></v-toolbar-side-icon>
<v-toolbar-title>Title</v-toolbar-title>
<v-spacer></v-spacer>
<v-toolbar-items class="hidden-sm-and-down">
<v-btn flat>Link One</v-btn>
<v-btn flat>Link Two</v-btn>
<v-btn flat>Link Three</v-btn>
</v-toolbar-items>
</v-toolbar>
<main id="scrolling-techniques" class="scroll-y"
style="max-height: 625px;">
<h1 v-for="n in 20" :key="n">{{n}}</h1>
</main>
</div>
</v-app>
For those who just wants to have a sticky element either above or below,
you might want to try snackbars
<v-snackbar v-model="snackbar" timeout="-1" top app>
jojojojojo asdfjasldf
</v-snackbar>
I'm using Vuetify and to create multiple styled v-card, each card should contain link to a target but only by clicking the card's internal title or image. The problem is that I'm looping over my array of object's and wrapping each v-card with <router-link> so the entire card is clickable. here is the code:
<router-link v-for="recipe in recipes" :key="recipe.title" :to="{path: `recipe/${recipe.title}`}">
<v-card>
<v-img :src="require('../assets/foodpic.jpg')" aspect-ratio="2.75"></v-img>
<v-card-title primary-title>
<div>
<h3 class="headline mb-0">{{ recipe.title }}</h3>
</div>
</v-card-title>
<v-card-actions>
<v-btn flat color="orange" disabled>Share</v-btn>
<v-btn flat color="orange">Explore</v-btn>
</v-card-actions>
</v-card>
</router-link>
i found a way to attach router link to specific element using tags but that only allows me to connect single html element and here i want to use the same link on multiple elements.
any idea how can i modify this code so only the v-img and v-card-title will be linked to the recipe?
hope it works for you
<v-card v-for="recipe in recipes" :key="recipe.title">
<v-img :src="require('../assets/foodpic.jpg')" aspect-ratio="2.75"
:to="{path: `recipe/${recipe.title}`}"></v-img>
<v-card-title primary-title :to="{path: `recipe/${recipe.title}`}">
<div>
<h3 class="headline mb-0">{{ recipe.title }}</h3>
</div>
</v-card-title>
<v-card-actions>
<v-btn flat color="orange" disabled>Share</v-btn>
<v-btn flat color="orange">Explore</v-btn>
</v-card-actions>
</v-card>
i ended up setting it like this:
<v-card v-for="recipe in recipes" :key="recipe.title">
<router-link :to="{path: `recipe/${recipe.title}`}">
<v-img :src="require('../assets/foodpic.jpg')" aspect-ratio="2.75"></v-img>
</router-link>
<v-card-title primary-title>
<div>
<router-link :to="{path: `recipe/${recipe.title}`}">
{{ recipe.title }}
</router-link>
</div>
</v-card-title>
<v-card-actions>
<v-btn flat color="orange" disabled>Share</v-btn>
<v-btn flat color="orange">Explore</v-btn>
</v-card-actions>
</v-card>
I am using vuetify and vuejs. I have 4 expansion panels that are aligned two columns and two rows. what i need is that when you click on one the rest 3 dissappear and the clicked one fill the entire container where they are located.
if you have a way of achieving this that isnt vuetify thats fine as well though id prefer vuetify
Html:
<div id="mainContent">
<v-app>
<v-container>
<v-layout row wrap>
<v-flex xs12 lg5 mb-3>
<v-expansion-panel popout>
<v-expansion-panel-content>
<div slot="header" v-on:click="isHidden = !isHidden">Title</div>
<v-card>
<v-card-text>
Content Goes here
</v-card-text>
</v-card>
</v-expansion-panel-content>
<v-expansion-panel-content>
<div slot="header" v-if="!isHidden">Title</div>
<v-card>
<v-card-text>
Content Goes here
</v-card-text>
</v-card>
</v-expansion-panel-content>
</v-expansion-panel>
</v-flex>
<v-flex xs12 lg5 mb-3>
<v-expansion-panel popout>
<v-expansion-panel-content>
<div slot="header">Title</div>
<v-card>
<v-card-text>
Content Goes here
</v-card-text>
</v-card>
</v-expansion-panel-content>
<v-expansion-panel-content>
<div slot="header">Title</div>
<v-card>
<v-card-text>
Content Goes here
</v-card-text>
</v-card>
</v-expansion-panel-content>
</v-expansion-panel>
</v-flex>
</v-layout>
</v-container>
</v-app>
</div>
script is:
<script>
var mainContent = new Vue({
el: '#mainContent',
data: {
isHidden : false
}
})
</script>
The mistake you are making is using v-flex containers as rows. As per documentation this sets flex: 1 1 auto, so there will always be as many elements in your row as there are DOM elements in your v-flex. If you wrap each element with a v-flex, and you use methods and computed values, i'm sure your task is attainable. Heres a small codepen you can fine-tune to get the task accomplished