code-8
code-8

Reputation: 58652

Vuetify : place title/subtitle next to icon in a card

enter image description here

I have a card component, and I'm trying to place my title, subtitle at the right of my icon.It some how kept going down to the next line. I'm new to Vuetify.

<template>
    <v-container fluid class="my-5">
        <v-row>
            <v-flex col-xs-12>
                <v-card elevation="2" class="pa-5">
                    <v-flex xs3>
                        <v-btn text color="black">
                            <v-icon left large class="mr-5">{{ icon }}</v-icon>
                        </v-btn>
                    </v-flex>
                    <v-flex xs9>
                        <v-card-title>
                            {{ title }}
                        </v-card-title>

                        <v-card-subtitle> {{ subtitle }} </v-card-subtitle>
                    </v-flex>
                </v-card>
            </v-flex>
        </v-row>
    </v-container>
</template>
<script>
export default {
    name: 'MainPanel',
    props: {
        icon: String,
        title: String,
        subtitle: String
    }
}
</script>
<style></style>

Please let me know how can I achive that.

Upvotes: 1

Views: 964

Answers (1)

tony19
tony19

Reputation: 138266

Apply the d-flex class to the v-card, which sets display:flex on the element, making its contents horizontally aligned:

<v-card elevation="2" class="pa-5 d-flex">
                                      👆

demo 1

Alternatively, wrap the contents of v-card in v-row (and replace the deprecated v-flex with v-col):

<v-card>
  <v-row>
    <v-col>...</v-col>
    <v-col>...</v-col>
  </v-row>
</v-card>

demo 2

Upvotes: 2

Related Questions