Reputation:
I have two flex inside a v-layout(fill-height). Problem: The second flex is aligned to end which is expected, but the first flex does not occupy the rest of the available space.
<v-container>
<v-layout row wrap fill-height>
<v-flex
xs12
class="white--text green darken-3"
>
<v-card-text>I should occupy rest of the available space</v-card-text>
</v-flex>
<v-flex
xs12
align-self-end
class="white--text blue darken-3"
>
</v-flex>
</v-layout>
</v-container>
Codepen:
https://codepen.io/adatdeltax/pen/MWaapYR?editors=1000
I am new to vuetify and above codepen is what I have tried till now ,is there any way to make flex1 occupy rest of the available space.
Upvotes: 4
Views: 10001
Reputation: 362760
With Vuetify 1.5:
Use column
and then remove the xs12
prop. Then shrink/grow will work as expected (no extra CSS or inline styles):
<div id="app">
<v-app id="inspire">
<v-container>
<v-layout column fill-height>
<v-flex
grow
class="white--text green darken-3"
>
<v-card-text>
I should occupy rest of the available space
</v-card-text>
</v-flex>
<v-flex
shrink
align-self-end
class="white--text blue darken-3"
>
<v-card-text>
I should stay here
</v-card-text>
</v-flex>
</v-layout>
</v-container>
</v-app>
</div>
1.5 Demo: https://codeply.com/p/JjD6UZdtjU
With Vuetify 2.x:
Works the same except v-row, v-col
are used instead of v-layout, v-flex
:
<div id="app">
<v-app>
<v-container class="fill-height">
<v-row class="no-gutters flex-wrap flex-column fill-height">
<v-col cols="auto" class="grow pink pa-2">
<h1>Content</h1>
</v-col>
<v-col cols="auto" class="shrink blue pa-2"> Footer </v-col>
</v-row>
</v-container>
</v-app>
</div>
2.x Demo: https://codeply.com/p/07CA4jZNAl
Upvotes: 5
Reputation: 3998
My solution is:
<v-layout column wrap fill-height>
<v-flex
style="flex:1"
xs12
class="white--text green darken-3"
>
</v-flex>
<v-flex
style="flex:0; width: 100%"
xs12
align-self-end
>
<v-card
dark
color="blue darken-1"
>
<v-card-text>I should stay here</v-card-text>
</v-card>
</v-flex>
</v-layout>
Upvotes: 1