I tried to create new row to place my table component there, and I want it to take the entire row
I've tried
<v-col cols="12">
<Table />
</v-col>
It goes to the right
I'm trying to have 2 rows in a card
<template>
<v-container fluid class="my-5">
<v-row>
<v-col cols="12">
<v-card elevation="2" class="d-flex">
<!-- Icon -->
<v-col cols="1">
<v-card-title>
<v-btn text color="black">
<v-icon left x-large>{{ icon }}</v-icon>
</v-btn>
</v-card-title>
</v-col>
<!-- Title & Subtitle -->
<v-col cols="11">
<v-card-title>
{{ title }}
</v-card-title>
<v-card-subtitle style="color: #757575"> {{ subtitle }} </v-card-subtitle>
<Table />
</v-col>
</v-card>
</v-col>
</v-row>
</v-container>
</template>
The vuetify component v-card defines several zones:
<v-card>
<v-card-title></v-card-title>
<v-card-subtitle></v-card-subtitle>
<v-card-text></v-card-text> <!-- this is the body of the card, where you should insert your table -->
<v-card-actions></v-card-actions>
</v-card>
Here you have your sample from this concept: https://codepen.io/jssDev-/pen/YzrVZjJ
You need to either create a grid inside each the card's children and use offset (example below) or create a grid inside the v-card and nest the card children in the second column that has width col-11 (not recommended as it goes outside the recommended card and card children nesting mentioned by @jssDev in the other answer).
<v-card elevation="2">
<v-card-title>
<v-row>
<v-col class="col-1">
<v-btn text>
<v-icon left x-large>
{{ icon }}
</v-icon>
</v-btn>
</v-col>
<v-col class="col-11 text-start">
{{ title }}
</v-col>
</v-row>
</v-card-title>
<v-card-subtitle>
<v-row>
<v-col class="offset-1 col-11 text-start">
{{ subtitle }}
</v-col>
</v-row>
</v-card-subtitle>
<v-card-text>
<v-row>
<v-col class="offset-1 col-11 text-start">
<v-data-table :headers="[]" :items="[]" />
</v-col>
</v-row>
</v-card-text>
</v-card>
The main problem here is your comprehension of the grid system in vuetify.
A good practice is to always put a col inside a row.
Also, vuetify has it's own way of composing a card :
A v-card is composed of 4 parts (which can be instanced any times each) :
v-card-actions (components contaning all your action buttons (save, exit, etc.))v-card-subtitle (subtitle of the card)v-card-text (any text that composed the card)v-card-title (title of the card)For your example, you can use the v-card-text to put your table. it will automatically be considred as a row containing 12 cols.
Here is an exemple of how to solve your problem
<template>
<v-card elevation="2">
<v-card-title>
<!-- first row of the card -->
<v-row>
<!-- first col of the row (1/12) -->
<v-col cols="1">
<v-btn text color="black">
<v-icon left x-large>mdi-link</v-icon>
</v-btn>
</v-col>
<!-- second col of the row (11/12) -->
<v-col cols="11">
Title of the card
</v-col>
</v-row>
</v-card-title>
<!-- Title & Subtitle -->
<v-card-subtitle style="color: #757575">
<!-- second row of the card -->
<v-row class="justify-end">
<!-- col inside the row 11/12 located at the end of the row with the flex class justify-end -->
<v-col cols="11">
Subtitle of the vcard
</v-col>
</v-row>
</v-card-subtitle>
<v-card-text>
<v-data-table
:headers="headers"
:items="desserts"
:items-per-page="5"
class="elevation-1"
></v-data-table>
</v-card-text>
</v-card>
</template>
<script>
export default {
name: "Hello",
data () {
return {
headers: [
{
text: 'Dessert (100g serving)',
align: 'start',
sortable: false,
value: 'name',
},
{ text: 'Calories', value: 'calories' },
{ text: 'Fat (g)', value: 'fat' },
{ text: 'Carbs (g)', value: 'carbs' },
{ text: 'Protein (g)', value: 'protein' },
{ text: 'Iron (%)', value: 'iron' },
],
desserts: [
{
name: 'Frozen Yogurt',
calories: 159,
fat: 6.0,
carbs: 24,
protein: 4.0,
iron: '1%',
},
{
name: 'Ice cream sandwich',
calories: 237,
fat: 9.0,
carbs: 37,
protein: 4.3,
iron: '1%',
},
{
name: 'Eclair',
calories: 262,
fat: 16.0,
carbs: 23,
protein: 6.0,
iron: '7%',
},
{
name: 'Cupcake',
calories: 305,
fat: 3.7,
carbs: 67,
protein: 4.3,
iron: '8%',
},
{
name: 'Gingerbread',
calories: 356,
fat: 16.0,
carbs: 49,
protein: 3.9,
iron: '16%',
},
{
name: 'Jelly bean',
calories: 375,
fat: 0.0,
carbs: 94,
protein: 0.0,
iron: '0%',
},
{
name: 'Lollipop',
calories: 392,
fat: 0.2,
carbs: 98,
protein: 0,
iron: '2%',
},
{
name: 'Honeycomb',
calories: 408,
fat: 3.2,
carbs: 87,
protein: 6.5,
iron: '45%',
},
{
name: 'Donut',
calories: 452,
fat: 25.0,
carbs: 51,
protein: 4.9,
iron: '22%',
},
{
name: 'KitKat',
calories: 518,
fat: 26.0,
carbs: 65,
protein: 7,
iron: '6%',
},
],
}
},
}
</script>