I am trying to insert footer to the Vuetify's list or menu or combobox. They all are pretty same. I tried every possibe css solution I could without solution.
This is what I want but I want the bottom button to be statically visible at the bottom even if scrolling:
Regular fixed css solution do not work no matter on what element I do apply styles.
This is the combobox I am trying to implement it to:
<v-combobox
style="min-width: 260px;"
dense
:value="item.description"
:items="products"
item-text="name"
item-value="id"
:error-messages="item.description_error"
:filter="filter_products"
#input="product_selected"
ref="description">
<template
slot="item"
slot-scope="{ index, item, parent }">
<v-list-tile-content v-if="!item.footer">{{ item.name }}</v-list-tile-content>
<v-btn v-else flat dark small style="padding-left:0!important;margin-left:0!important;display:table-row;width:100%"
color="primary"
depressed
:ripple="false"
#click.stop="add_new_product"><v-icon left>add_box</v-icon>{{ item.footer }}</v-btn>
</template>
</v-combobox>
Also tried using v-menu and v-list
<v-menu max-height="250px">
<v-text-field label="Hello" slot="activator"></v-text-field>
<v-list>
<v-list-tile v-for="item in 10">hello</v-list-tile>
</v-list>
<p style="position: fixed; bottom: 0;">IUWHEGIuiHWEGIUHGIWUEHGIUWHEGIUHWEIUG</p>
</v-menu>
Codepen
We need to add max-height and overflow: auto to the v-list element so that we can scroll the list, and not the whole menu.
Add "footer" to the bottom of the v-menu and it should work as expected.
And just wrap it inside the v-card for example so that menu is not transparent.
<v-menu v-model="menu" offset-y>
<v-btn slot="activator">Menu</v-btn>
<v-card>
<v-list class="custom-list">
<v-list-tile v-for="item in items"></v-list-tile>
</v-list>
<v-divider></v-divider>
<div class="pa-1" #click.stop="">
<v-btn flat dark small color="primary" depressed :ripple="false">
<v-icon left>add_box</v-icon>
footer button
</v-btn>
</div>
</v-card>
</v-menu>
css
.custom-list {
max-height:200px;
overflow: auto;
}
We can use #click.stop="" to prevent it from closing the menu.
Related
When wrapping some components inside a badge they loose their original width
<v-badge color="warning" icon="mdi-lock">
<v-text-field label="lost width due to badge" />
</v-badge>
which results into this ( reproduction link )
I know that the textfield component provides an append slot
<v-text-field label="field goes here">
<template v-slot:append>
<v-avatar color="warning" size="small">
<v-icon icon="mdi-lock" />
</v-avatar>
</template>
</v-text-field>
but this is not the same ( reproduction link )
Is there a way to use the badge but don't affect actual widths?
Add a width: 100% to the badge tag like below:
<template>
<v-app>
<v-main>
<v-container>
<v-text-field label="width is fine" />
<v-badge style="width: 100%" color="warning" icon="mdi-lock">
<v-text-field label="lost width due to badge" />
</v-badge>
</v-container>
</v-main>
</v-app>
</template>
result:
I have a mat drawer to the right of the screen and I am trying to stick a button to it, so the overall design is clear.
Example
How can I manage to do this action? So far I have tried adding the button inside of the drawer and giving it a negative left: -10px in order to overlay the drawer.
<mat-drawer-container class="example-container" [hasBackdrop]="false">
<mat-drawer style="width: 600px;" position="end" #drawer2 [mode]="over">
<button style="left: -10px; z-index: 1000;" mat-raised-button (click)="drawer2.toggle()">Side Nav</button> HERE
<mat-tab-group>
<mat-tab>
<ng-template mat-tab-label>
<mat-icon> layers</mat-icon>
<span>Componenti</span>
</ng-template>
<components [itemCategoryAreas]="itemCategoryAreas"></components>
</mat-tab>
<mat-tab>
<ng-template mat-tab-label>
<mat-icon>wallpaper</mat-icon>
<span>Disegno</span>
</ng-template>
Content 1
</mat-tab>
<mat-tab>
<ng-template mat-tab-label>
<mat-icon>list</mat-icon>
<span>Checklist</span>
</ng-template>
Content 1
</mat-tab>
</mat-tab-group>
</mat-drawer>
🚂 Might help! Try something like this:
.app-toolbar {
position: sticky;
position: -webkit-sticky; /* For macOS/iOS Safari */
top: 0; /* Sets the sticky toolbar to be on top */
z-index: 1000; /*app's content doesn't overlap the toolbar */
}
don't forget to change the classname though, Hope it helps :)
Then,
If you want your button to stick permanent to its position, you should use
position: fixed;
instead of
position: sticky;
I've been struggling with an issue for a while now and I was hoping that a fix would be released and the issue would resolve itself. It did not unfortunately. I have this basic code in my App.vue that is using vuetify elements:
<template>
<v-app class="app" id="inspire">
<v-content>
<v-container class="fill-height" fluid>
<v-row align="center" justify="center">
<v-col class="text-center">
<v-card outlined>
<span>Source</span>
</v-card>
</v-col>
</v-row>
</v-container>
</v-content>
</v-app>
</template>
This looks fine. However, when I scale down to a mobile device, the v-card is not centered, but pushed to the left. See image below. When I remove the fill-height property on the container, everything looks correctly, but I would like to center the v-card vertically on my page. Is this a Vuetify issue? I could not find this exact issue described anywhere else. Is there maybe something wrong in my setup?
Thanks in advance!
Jeroen
The margin-right: -12px and margin-left: -12px that come from the .container.fill-height > .row element are causing the issue. Doesn't seem that they are aware otherwise they would add margin: auto of some kind to resolve it. Hope that helps.
In my project, I have a scrollable list of items, and each item has a menu that is opened when its activator button is hovered.
By default, v-menu elements are attached to the v-app element, which serves as a mounting point for many Vuetify elements. When I use this default behavior, the generated HTML contains many detached div elements for the popup menu, one per item in the list, in the generated v-app div:
<div class="menu__content" style="min-width: 0px; top: 12px; left: 0px; transform-origin: left top 0px; z-index: 0; display: none;"></div>
This is impacting the reading of the rendered DOM, and the result is a bit messy especially when debugging.
Also, once the menu is opened, and the list is scrolled, the menu remains at a fixed position and therefore gets visually detached from its activator button.
How could I attach the menu to each item of the list in order to have a more readable rendered DOM (see below)?
<my-list>
<my-item>
<div class="menu__content" style="min-width: 0px; top: 12px; left: 0px; transform-origin: left top 0px; z-index: 0; display: none;"></div>
</my-item>
</my-list>
And how can I have the v-menu stick to its activator button when the list is scrolled?
Check out the documentation under the following link and search for "attach":
https://vuetifyjs.com/en/components/menus
"Attach": Specifies which DOM element that this component should detach to. Use either a CSS selector string or an object reference to the element.
So when you have a menu like e.g. this:
<v-menu>
<v-btn slot="activator">
Click
</v-btn>
<v-card>
Content
</v-card>
</v-menu>
You can attach it to an element, let's say the button itself, like so:
<v-menu attach="#fooAnchor">
<v-btn slot="activator" id="fooAnchor">
Click
</v-btn>
<v-card>
Content
</v-card>
</v-menu>
And of course you can place id="fooAnchor" wherever you want.
This is the latest solution you can try this one below
<v-menu
offset-x
bottom
right
attach="zoom-feature"
>
<template v-slot:activator="{ on, attrs }">
<v-btn
id="zoom-feature"
v-bind="attrs"
v-on="on"
>
Click Me
</v-btn>
</template>
<v-card>
I am Card
</v-card>
</v-menu>
I'm developing an Ionic app, and having trouble with my header component. Its elements are wrapping with small screen sizes, and I would like them not to.
Here's the goal:
Here's what's happening now:
I know I could set a fixed width to the header, but I would like not to. I also wouldn't like to use JavaScript to calculate the width.
Here's the HTML/Angular/Ionic code for the title component:
<h1 *ngIf="backButton; else titleBackButton">{{ title }}</h1> <!-- show if backButton != true -->
<ng-template #titleBackButton> <!-- show if backButton == true -->
<button ion-button round class="button-back">
<ion-icon name="arrow-back"></ion-icon>
</button>
<h1 class="floated-title">{{ title }}</h1> <!-- this has been floated to the right -->
</ng-template>
Here are my CSS styles:
.button-back {
margin: 17px 0 0 10px;
}
.floated-title {
float: right;
}
Any time you want to force elements to line-up in a row, and never wrap, give the parent container display: flex. This automatically applies flex-wrap: nowrap and flex-direction: row.
The above suggestion applies to plain CSS. Some frameworks may set different defaults.
For instance, in React, flex-direction defaults to column.
Alternatively, you can apply white-space: nowrap to the container, which suppresses all line breaks inside the container.