Change vue's expansion panel expanded text - vuetify.js

How can i toggle the text displayed when a user toggles the expanded state of an expansion panel? I thought this would work but the 'open' value doesn't appear to trigger correctly.
<!-- Details -->
<v-expansion-panels flat hover>
<v-expansion-panel>
<v-expansion-panel-header disable-icon-rotate>
{{ title }}
<template v-slot:actions>
<span v-if="open" class="overline text--disabled">Show Details</span>
<span v-else class="overline text--disabled">Hide Details</span>
</template>
</v-expansion-panel-header>
<v-expansion-panel-content>
<v-row>
<v-col cols="4">somos</v-col>
<v-col cols="4">somos</v-col>
<v-col cols="4">somos</v-col>
</v-row>
</v-expansion-panel-content>
</v-expansion-panel>
</v-expansion-panels>

I don't know if you are using vuetify v2, but I guess it.
So to get the "open" value, you must to use the default slot:
<v-expansion-panel>
<!-- add expand-icon="" to remove the arrow icon -->
<v-expansion-panel-header disable-icon-rotate expand-icon="">
<template v-slot:default="{ open }">
<v-row no-gutters>
<v-col cols="4">{{ title }}</v-col>
<v-col cols="4"></v-col>
<v-col cols="4">
<span v-if="!open" key="0" class="overline text--disabled">Show Details</span>
<span v-else key="1" class="overline text--disabled">Hide Details</span>
</v-col>
</v-row>
</template>
</v-expansion-panel-header>
<v-expansion-panel-content>
<v-row>
<v-col cols="4">somos</v-col>
<v-col cols="4">somos</v-col>
<v-col cols="4">somos</v-col>
</v-row>
</v-expansion-panel-content>
</v-expansion-panel>
You can use the header as you consider, I mean, without v-row or v-col:
<v-expansion-panel-header disable-icon-rotate v-slot="{ open }" expand-icon="">
<v-layout align-center justify-space-between/>
title
<span v-if="open" key="0" class="overline text--disabled">Show Details</span>
<span v-else key="1" class="overline text--disabled">Hide Details</span>
</v-layout>
</v-expansion-panel-header>

Related

I need side bar in laravel jetstream inertia vue

I need side bar in laravel jetstream inertia vue
enter image description here
<script setup>
import { ref } from 'vue';
import { Inertia } from '#inertiajs/inertia';
import { Head, Link } from '#inertiajs/inertia-vue3';
import ApplicationMark from '#/Components/ApplicationMark.vue';
import Banner from '#/Components/Banner.vue';
import Dropdown from '#/Components/Dropdown.vue';
import DropdownLink from '#/Components/DropdownLink.vue';
import NavLink from '#/Components/NavLink.vue';
import ResponsiveNavLink from '#/Components/ResponsiveNavLink.vue';
defineProps({
title: String,
});
const showingNavigationDropdown = ref(false);
const switchToTeam = (team) => {
Inertia.put(route('current-team.update'), {
team_id: team.id,
}, {
preserveState: false,
});
};
const logout = () => {
Inertia.post(route('logout'));
};
</script>
<template>
<div>
<Head :title="title" />
<Banner />
<div class="min-h-screen bg-gray-100">
<nav class="bg-white border-b border-gray-100">
<!-- Primary Navigation Menu -->
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<div class="flex justify-between h-16">
<div class="flex">
<!-- Logo -->
<div class="shrink-0 flex items-center">
<Link :href="route('dashboard')">
<ApplicationMark class="block h-9 w-auto" />
</Link>
</div>
<!-- Navigation Links -->
<div class="hidden space-x-8 sm:-my-px sm:ml-10 sm:flex">
<NavLink :href="route('dashboard')" :active="route().current('dashboard')">
Dashboard
</NavLink>
</div>
</div>
<div class="hidden sm:flex sm:items-center sm:ml-6">
<div class="ml-3 relative">
<!-- Teams Dropdown -->
<Dropdown v-if="$page.props.jetstream.hasTeamFeatures" align="right" width="60">
<template #trigger>
<span class="inline-flex rounded-md">
<button type="button" class="inline-flex items-center px-3 py-2 border border-transparent text-sm leading-4 font-medium rounded-md text-gray-500 bg-white hover:bg-gray-50 hover:text-gray-700 focus:outline-none focus:bg-gray-50 active:bg-gray-50 transition">
{{ $page.props.user.current_team.name }}
<svg class="ml-2 -mr-0.5 h-4 w-4" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" d="M8.25 15L12 18.75 15.75 15m-7.5-6L12 5.25 15.75 9" />
</svg>
</button>
</span>
</template>
<template #content>
<div class="w-60">
<!-- Team Management -->
<template v-if="$page.props.jetstream.hasTeamFeatures">
<div class="block px-4 py-2 text-xs text-gray-400">
Manage Team
</div>
<!-- Team Settings -->
<DropdownLink :href="route('teams.show', $page.props.user.current_team)">
Team Settings
</DropdownLink>
<DropdownLink v-if="$page.props.jetstream.canCreateTeams" :href="route('teams.create')">
Create New Team
</DropdownLink>
<div class="border-t border-gray-100" />
<!-- Team Switcher -->
<div class="block px-4 py-2 text-xs text-gray-400">
Switch Teams
</div>
<template v-for="team in $page.props.user.all_teams" :key="team.id">
<form #submit.prevent="switchToTeam(team)">
<DropdownLink as="button">
<div class="flex items-center">
<svg v-if="team.id == $page.props.user.current_team_id" class="mr-2 h-5 w-5 text-green-400" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" d="M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
</svg>
<div>{{ team.name }}</div>
</div>
</DropdownLink>
</form>
</template>
</template>
</div>
</template>
</Dropdown>
</div>
<!-- Settings Dropdown -->
<div class="ml-3 relative">
<Dropdown align="right" width="48">
<template #trigger>
<button v-if="$page.props.jetstream.managesProfilePhotos" class="flex text-sm border-2 border-transparent rounded-full focus:outline-none focus:border-gray-300 transition">
<img class="h-8 w-8 rounded-full object-cover" :src="$page.props.user.profile_photo_url" :alt="$page.props.user.name">
</button>
<span v-else class="inline-flex rounded-md">
<button type="button" class="inline-flex items-center px-3 py-2 border border-transparent text-sm leading-4 font-medium rounded-md text-gray-500 bg-white hover:text-gray-700 focus:outline-none focus:bg-gray-50 active:bg-gray-50 transition">
{{ $page.props.user.name }}
<svg class="ml-2 -mr-0.5 h-4 w-4" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5" />
</svg>
</button>
</span>
</template>
<template #content>
<!-- Account Management -->
<div class="block px-4 py-2 text-xs text-gray-400">
Manage Account
</div>
<DropdownLink :href="route('profile.show')">
Profile
</DropdownLink>
<DropdownLink v-if="$page.props.jetstream.hasApiFeatures" :href="route('api-tokens.index')">
API Tokens
</DropdownLink>
<div class="border-t border-gray-100" />
<!-- Authentication -->
<form #submit.prevent="logout">
<DropdownLink as="button">
Log Out
</DropdownLink>
</form>
</template>
</Dropdown>
</div>
</div>
<!-- Hamburger -->
<div class="-mr-2 flex items-center sm:hidden">
<button class="inline-flex items-center justify-center p-2 rounded-md text-gray-400 hover:text-gray-500 hover:bg-gray-100 focus:outline-none focus:bg-gray-100 focus:text-gray-500 transition" #click="showingNavigationDropdown = ! showingNavigationDropdown">
<svg
class="h-6 w-6"
stroke="currentColor"
fill="none"
viewBox="0 0 24 24"
>
<path
:class="{'hidden': showingNavigationDropdown, 'inline-flex': ! showingNavigationDropdown }"
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="2"
d="M4 6h16M4 12h16M4 18h16"
/>
<path
:class="{'hidden': ! showingNavigationDropdown, 'inline-flex': showingNavigationDropdown }"
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="2"
d="M6 18L18 6M6 6l12 12"
/>
</svg>
</button>
</div>
</div>
</div>
<!-- Responsive Navigation Menu -->
<div :class="{'block': showingNavigationDropdown, 'hidden': ! showingNavigationDropdown}" class="sm:hidden">
<div class="pt-2 pb-3 space-y-1">
<ResponsiveNavLink :href="route('dashboard')" :active="route().current('dashboard')">
Dashboard
</ResponsiveNavLink>
</div>
<!-- Responsive Settings Options -->
<div class="pt-4 pb-1 border-t border-gray-200">
<div class="flex items-center px-4">
<div v-if="$page.props.jetstream.managesProfilePhotos" class="shrink-0 mr-3">
<img class="h-10 w-10 rounded-full object-cover" :src="$page.props.user.profile_photo_url" :alt="$page.props.user.name">
</div>
<div>
<div class="font-medium text-base text-gray-800">
{{ $page.props.user.name }}
</div>
<div class="font-medium text-sm text-gray-500">
{{ $page.props.user.email }}
</div>
</div>
</div>
<div class="mt-3 space-y-1">
<ResponsiveNavLink :href="route('profile.show')" :active="route().current('profile.show')">
Profile
</ResponsiveNavLink>
<ResponsiveNavLink v-if="$page.props.jetstream.hasApiFeatures" :href="route('api-tokens.index')" :active="route().current('api-tokens.index')">
API Tokens
</ResponsiveNavLink>
<!-- Authentication -->
<form method="POST" #submit.prevent="logout">
<ResponsiveNavLink as="button">
Log Out
</ResponsiveNavLink>
</form>
<!-- Team Management -->
<template v-if="$page.props.jetstream.hasTeamFeatures">
<div class="border-t border-gray-200" />
<div class="block px-4 py-2 text-xs text-gray-400">
Manage Team
</div>
<!-- Team Settings -->
<ResponsiveNavLink :href="route('teams.show', $page.props.user.current_team)" :active="route().current('teams.show')">
Team Settings
</ResponsiveNavLink>
<ResponsiveNavLink v-if="$page.props.jetstream.canCreateTeams" :href="route('teams.create')" :active="route().current('teams.create')">
Create New Team
</ResponsiveNavLink>
<div class="border-t border-gray-200" />
<!-- Team Switcher -->
<div class="block px-4 py-2 text-xs text-gray-400">
Switch Teams
</div>
<template v-for="team in $page.props.user.all_teams" :key="team.id">
<form #submit.prevent="switchToTeam(team)">
<ResponsiveNavLink as="button">
<div class="flex items-center">
<svg v-if="team.id == $page.props.user.current_team_id" class="mr-2 h-5 w-5 text-green-400" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" d="M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
</svg>
<div>{{ team.name }}</div>
</div>
</ResponsiveNavLink>
</form>
</template>
</template>
</div>
</div>
</div>
</nav>
<!-- Page Heading -->
<header v-if="$slots.header" class="bg-white shadow">
<div class="max-w-7xl mx-auto py-6 px-4 sm:px-6 lg:px-8">
<slot name="header" />
</div>
</header>
<!-- Page Content -->
<main>
<slot />
</main>
</div>
</div>
</template>
this code app layout i need side bar
this code app layout i need side bar
this code app layout i need side bar
this code app layout i need side bar
this code app layout i need side bar
this code app layout i need side bar
this code app layout i need side bar
this code app layout i need side bar
this code app layout i need side bar
this code app layout i need side bar
this code app layout i need side bar
this code app layout i need side bar

How to align this Vuetify (bootstrap) v-col to the bottom of its parent row?

I have tried everything I can think of but I cannot get the "Read More" hyperlink to sit at the bottom of the parent row, so that 'Read More' is at the bottom-right of the container. No combination of justify or align seems to help.
The article image is supposed to sit on the left, and then the article header goes to the right of the image with "Read More" at the bottom right of the entire panel. I suppose the easiest way to do this would be to have the hyperlink's column aligned to the bottom of the v-row and then just use text-right for formatting.
<v-row>
<v-col>
<h1 style='display: inline'>{{article.title}}</h1> <span style='font-size: x-small'>{{article.month}}.{{article.day}}.{{article.year}}</span>
</v-col>
</v-row>
<v-row style='padding: 0px; margin-top: -25px; margin-bottom: -15px'>
<v-col>
<hr>
</v-col>
</v-row>
<v-row>
<v-col md='4' class='text-center'>
<img :src="article.image" class='article-image'>
</v-col>
<v-col>
<v-row>
<v-col>
<p>{{article.header}}</p>
</v-col>
</v-row>
<v-row>
<v-col class='text-center'>
<a>>>> Read More <<<</a>
</v-col>
</v-row>
</v-col>
</v-row>
The final solution, including both read sections:
<template>
<v-container fluid class='content-body'>
<v-row>
<v-col cols="12">
<h1 class="ml-2" style="display: inline">{{ item.title }}</h1>
<span style="font-size: x-small">{{ item.date }}</span>
</v-col>
<v-col style='padding: 0; margin-top: -15px; margin-bottom: -15px' cols="12">
<hr />
</v-col>
<v-row v-if='!readMore' class='mb-1 pr-1 pl-1'>
<v-col md="4" class="text-center">
<v-img class="ml-1 mr-1 mb-1 article-image" :src="item.image"/>
</v-col>
<v-col md="8">
<v-row class="fill-height" dense>
<v-col cols="12" class='mb-2 ml-1 mr-1'>
<h3>{{ item.header }}</h3>
</v-col>
<v-col cols="12" class="text-right pb-0 mb-0" align-self="end">
<v-btn color='#0a0a0a' class='blue--text mr-0' v-on:click="showMore">Read More</v-btn>
</v-col>
</v-row>
</v-col>
</v-row>
<v-row v-else class='mb-1 pr-1 pl-1'>
<v-col cols='12'>
<nuxt-content :document='item'/>
</v-col>
<v-col cols="12" class="text-right" align-self="end">
<v-btn color='#0a0a0a' class='blue--text mr-0' v-on:click="showLess">Read Less</v-btn>
</v-col>
</v-row>
</v-row>
</v-container>
</template>
You need to use the <v-col align-self="end"> attributes to align the y-axis.
I fixed your code. Here is the code snippet.
<v-row>
<v-col cols="12">
<h1 class="ml-2" style="display: inline">{{ article.title }}</h1>
<span style="font-size: x-small">{{ article.month }}.{{ article.day }}.{{ article.year }}</span>
</v-col>
<v-col
cols="12"
><hr />
</v-col>
<v-col md="4" class="text-center">
<v-img class="ml-2 mb-3" :src="article.image" height="200px"/>
</v-col>
<v-col md="8" class="text-center">
<v-row class="fill-height mr-2" dense>
<v-col cols="12">
<p>{{ article.header }}</p>
</v-col>
<v-col cols="12" class="text-right" align-self="end">
<a>>>>Read More<<<</a>
</v-col>
</v-row>
</v-col>
</v-row>
The full code you can see in the CodePen. The result is as shown below.
Try this:
<v-row>
<v-col>
<h1 style='display: inline'>{{article.title}}</h1> <span style='font-size: x-small'>{{article.month}}.{{article.day}}.{{article.year}}</span>
</v-col>
</v-row>
<v-row style='padding: 0px; margin-top: -25px; margin-bottom: -15px'>
<v-col>
<hr>
</v-col>
</v-row>
<v-row>
<v-col md='4' class='text-center'>
<img :src="article.image" class='article-image'>
</v-col>
<v-col class="d-flex">
<v-row>
<v-col>
<p>{{article.header}}</p>
</v-col>
</v-row>
<v-row class="align-self-end">
<v-col class='text-end'>
<a>>>> Read More <<<</a>
</v-col>
</v-row>
</v-col>
</v-row>

How do I prepend the drop down arrow on a parent v-list-group expansion panel?

I'm trying to prepend the drop down arrow on a v-list-group and append a search icon. It's working, but the search icon flips when the list is opened and not the dropdown icon like is to be expected
<v-list-group
v-for="item in items"
:key="item.title"
prepend-icon="$expand"
append-icon="search"
v-model="item.active"
no-action
>
<template v-slot:activator v-slot:prependIcon>
<v-list-item-content>
<v-list-item-title v-text="item.title"></v-list-item-title>
</v-list-item-content>
</template>
<v-list-item
v-for="child in item.items"
:key="child.title"
>
<v-list-item-avatar>
<v-img max-height="30" max-width="30" :src="child.avatar"></v-img>
</v-list-item-avatar>
<v-list-item-content>
<v-list-item-title v-text="child.title"></v-list-item-title>
</v-list-item-content>
</v-list-item>
</v-list-group>
How do I fix this?
Codepen example.
For the solution I added the sub-group property to the list group and added the icon in the activator slot via v-list-item-icon.
<v-list-group
v-for="item in items"
:key="item.title"
prepend-icon="$expand"
v-model="item.active"
no-action
sub-group
>
<template v-slot:activator>
<v-list-item-content>
<v-list-item-title v-text="item.title"></v-list-item-title>
</v-list-item-content>
<v-list-item-icon>
<v-icon>mdi-magnify</v-icon>
</v-list-item-icon>
</template>
<v-list-item
v-for="child in item.items"
:key="child.title"
>
<v-list-item-avatar>
<v-img
max-height="30"
max-width="30"
:src="child.avatar"
></v-img>
</v-list-item-avatar>
<v-list-item-content>
<v-list-item-title v-text="child.title"></v-list-item-title>
</v-list-item-content>
</v-list-item>
</v-list-group>
sub-group isn't very well documented but apparently it moves the expand icon to the left.

How to obtain same left and right margin on a card with list items

I'm building a card with some items and i need to align to the right the items with texts 3576000 (plus KG icon), 120/180, and 67%. Seems that i'm doing somethig wrong, the left margin is narrow than right margin of card,
<div id="app">
<v-app id="inspire" fluid>
<v-card>
<v-list>
<v-list-item>
<v-list-item-content>
<v-list-item-title class="headline">UNLOADED TRUCKS</v-list-item-title>
</v-list-item-content>
<v-btn icon>
<v-icon color="primary">mdi-refresh</v-icon>
</v-btn>
</v-list-item>
<v-list-item>
<v-list-item-content>
<v-list-item-icon>
<v-icon color="black" size=80>mdi-truck-check</v-icon>
</v-list-item-icon>
</v-list-item-content>
<v-list-item-content>
<v-list-item class="py-n5 my-n5">
<v-list-item-title align="right" class="px-n3 mx-n3">3576000</v-list-item-title>
<v-list-item-icon>
<v-icon color="black">mdi-weight-kilogram</v-icon>
</v-list-item-icon>
</v-list-item>
<v-list-item>
<v-list-item-title align="right" class="display-2">120/180</v-list-item-title>
</v-list-item>
<v-list-item class="py-n5 my-n5">
<v-list-item-subtitle align="right">67%</v-list-item-subtitle>
</v-list-item>
</v-list-item-content>
</v-list-item>
<v-progress-linear value=67></v-progress-linear>
<v-list-item class="py-n2 my-n2">
<v-list-item-icon class="px-0 mr-1">
<v-icon>mdi-clock</v-icon>
</v-list-item-icon>
<v-list-item-subtitle>Updated 19 minutes ago</v-list-item-subtitle>
</v-list-item>
<v-divider></v-divider>
<v-card-actions>
<v-btn text color="primary">Full Report</v-btn>
</v-card-actions>
</v-list>
</v-card>
</v-app>
sample is in https://codepen.io/wolverine4277/pen/ZEGBBze, and image show the differents margins is attached. I can't figure out how correct that, i try between and nothing change...
enter image description here
The left and right margins of the card are okay. The issue is with the padding and margins of the list items.
If you wrap the "v-list-item-icon" with v-list-item giving it the same class (py-n5 my-n5" then it would appear fine
<v-list-item class="py-n5 my-n5">
<v-list-item-icon>
<v-icon color="black" size=80>mdi-truck-check</v-icon>
</v-list-item-icon>
</v-list-item>

How do you have an element fill the remaining height in vuetify 2.0?

I am attempting to create a view where there is a top element with a secondary element vertically centered in the remaining space underneath it.
In my attempt, there is a section of whitespace that gets added below the second element which extends the height of the page instead of just filling it as intended.
A recreation of this issue can be found here: https://codepen.io/R3d4rmy/pen/BaBjvwy
<div id="app">
<v-app id="inspire">
<v-app-bar app color="indigo" dark>
<v-toolbar-title>Application</v-toolbar-title>
</v-app-bar>
<v-content>
<v-container fluid class="fill-height">
<v-row class="fill-height">
<v-col
cols="12"
sm="10"
offset-sm="1"
md="8"
offset-md="2"
lg="6"
offset-lg="3"
xl="4"
offset-xl="4"
>
<v-row class="fill-height">
<v-col cols="12">
<v-row class="no-gutters">
<v-col cols="12">
<v-card class="mb-6" outlined>
<v-card-title>
Title
</v-card-title>
<v-card-text>
<div class="subtitle-2">
Subtitle
</div>
</v-card-text>
<v-divider class="mx-4"></v-divider>
<v-card-text>
<v-text-field
flat
single-line
></v-text-field>
</v-card-text>
</v-card>
</v-col>
</v-row>
<v-row class="fill-height no-gutters" align="center">
<v-col cols="12">
<v-row class="no-gutters" justify="center">
<v-col align-self="center" cols="12">
<v-card class="mb-6" outlined>
<v-card-title>
Why is there extra whitespace below this v-card?
</v-card-title>
<v-card-text>
<div class="subtitle-2">
And how do I get this v-card properly centered in the remaining space below the first v-card?
</div>
</v-card-text>
</v-card>
</v-col>
</v-row>
</v-col>
</v-row>
</v-col>
</v-row>
</v-col>
</v-row>
</v-container>
</v-content>
<v-footer color="indigo" app>
<span class="white--text">© 2019</span>
</v-footer>
</v-app>
</div>
I feel I may be misunderstanding the syntax after the upgrade to 2.0 and not using v-row and v-col in the right way with fill-height. Any help is appreciated, thank you!
It seems like you're using too many v-rows and v-cols. You can get rid of a lot of those if you just want one card after another stacked in a column. The revised codepen is here: https://codepen.io/CodingDeer/pen/KKPzxYW
<div id="app">
<v-app id="inspire">
<v-app-bar app color="indigo" dark>
<v-toolbar-title>Application</v-toolbar-title>
</v-app-bar>
<v-content>
<v-container fluid class="fill-height">
<v-row class="fill-height">
<v-col
cols="12"
sm="10"
offset-sm="1"
md="8"
offset-md="2"
lg="6"
offset-lg="3"
xl="4"
offset-xl="4"
>
<v-card class="mb-6" outlined>
<v-card-title>
Title
</v-card-title>
<v-card-text>
<div class="subtitle-2">
Subtitle
</div>
</v-card-text>
<v-divider class="mx-4"></v-divider>
<v-card-text>
<v-text-field
flat
single-line
></v-text-field>
</v-card-text>
</v-card>
<v-col cols="12" class="pa-0 fill-height" justify-self='center'>
<v-row
align="center"
justify="center"
class="fill-height"
>
<v-card outlined>
<v-card-title>
Why is there extra whitespace below this v-card?
</v-card-title>
<v-card-text>
<div class="subtitle-2">
And how do I get this v-card properly centered in the remaining space below the first v-card?
</div>
</v-card-text>
</v-card>
</v-row>
</v-col>
</v-col>
</v-row>
</v-container>
</v-content>
<v-footer color="indigo" app>
<span class="white--text">© 2019</span>
</v-footer>
</v-app>
</div>

Resources