0
votes

Please advise how to make vuetify v-tabs content displayed in equal height blocks. I found no options for this component in documentation which can help with height alignment.

By default v-tab-item height depends on its own content height:
enter image description here enter image description here

Layout example:

<div id="app">
    <v-app id="inspire">
        <div>
            <v-tabs v-model="active" color="cyan" dark slider-color="yellow">
                <v-tab :key="tab-1">
                    tab 1

                </v-tab>
                <v-tab :key="tab-2">
                    tab 2

                </v-tab>
                <v-tab-item key="tab-1">
                    tab 1 content<br> tab 1 content<br> tab 1 content<br> tab 1 content<br> tab 1 content<br>
                </v-tab-item>
                <v-tab-item key="tab-2">
                    tab 2 content
                </v-tab-item>
            </v-tabs>

        </div>
    </v-app>
</div>

https://codepen.io/olegef/pen/MqKaxQ

Is it possible to align v-tab-items height by tallest v-tab-item using CSS only?

1
Just use height: value; in your v-tabs__content class? Codepengil
If you would like tab items to fill the remaining height you might be interested in this approach stackoverflow.com/a/61855170/5598194N. Kudryavtsev

1 Answers

1
votes

If you haven't tried yet, then setting your desired height (not min-heightexplanation here) value in v-tabs__content class.

Codepen ...

new Vue({
  el: '#app'
})
.v-tabs__content {
  background-color: green;
  height: 100px;
}
<div id="app">
  <v-app id="inspire">
    <div>
      <v-tabs v-model="active" color="cyan" dark slider-color="yellow">
        <v-tab :key="tab-1">
          tab 1

        </v-tab>
        <v-tab :key="tab-2">
          tab 2

        </v-tab>
        <v-tab-item key="tab-1">
          tab 1 content<br> tab 1 content<br> tab 1 content<br> tab 1 content<br> tab 1 content<br>
        </v-tab-item>
        <v-tab-item key="tab-2">
          tab 2 content
        </v-tab-item>
      </v-tabs>

    </div>
  </v-app>
</div>

<link href='https://fonts.googleapis.com/css?family=Roboto:300,400,500,700|Material+Icons' rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/vuetify/dist/vuetify.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vuetify/dist/vuetify.js"></script>