Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to invert headers direction with Vuetify?

Everything is pretty much said in the title.

In the documentation, Vuetify builds a table with mutliple objects that all have the same properties. Like this:

https://vuetifyjs.com/en/components/data-tables

headers: [
        {
          text: 'Dessert (100g serving)',
          align: 'left',
          sortable: false,
          value: 'name',
        },
        { text: 'Calories', value: 'calories' },
        { text: 'Fat (g)', value: 'fat' },
        { text: 'Carbs (g)', value: 'carbs' },
        { text: 'Protein (g)', value: 'protein' },
        { text: 'Actions', value: 'action', sortable: false },
      ]

This will show headers in the first row and then you will have a list of different Dessert objects.

What I need is to have headers displayed vertically in the first column, and than the value of that 1 object in the second column. Like this, where Password and Security question would be my 2 headers:

enter image description here

What is the best example on how to build this with Vuetify?

like image 559
Philx94 Avatar asked Jan 22 '26 18:01

Philx94


1 Answers

If you really want to use a data table for this you could perhaps just do this simply with CSS using flex-box.

Add the following CSS (you may want to create separate classes to prevent conflicts with other tables).

table tr {
   display:flex;
   flex-direction: column;
   float: left;
}

thead,tbody {
  float: left;
}

Here is a working example on Codepen https://codepen.io/pixelskribe/pen/VwwLwXa

like image 172
skribe Avatar answered Jan 24 '26 09:01

skribe