Manuel Perez Heredia
Manuel Perez Heredia

Reputation: 2357

Vuetify text fields on one line

I have this template for a Vue component (See it in CODEPEN):

<div class="some-class">
    <v-form >
        <v-container @click="someMethod()">
            <v-row>
                <v-col cols="3" sm="3" v-for="p in placeholders" :key="p">
                    <v-text-field :placeholder="p" single-line outlined >
                    </v-text-field>
                </v-col>
            </v-row>
        </v-container>
    </v-form>
</div>

where placeholders is an array like:

['Title 1', 'Title 2', 'Title 3',...'Title 21']

and some-class is in the style section of the component:

<style>
    div.some-class {
        display: inline-block;
        max-width: 100%;
        overflow-x: auto;
    }
</style>

I would like to have them all on one line so I can scroll horizontally. But instead I get this:

enter image description here

How can I tweak the style to see all the text fields on one line?

Upvotes: 1

Views: 8110

Answers (1)

Cathy Ha
Cathy Ha

Reputation: 1677

Vuetify uses a flex grid. The reason that it's not overflowing is that you have to set the flex-wrap to nowrap.

Basically, just add the styles below to your v-row:

.nowrap-overflow {
    flex-wrap: nowrap;
    overflow-x: auto;
}

Modified codepen here: https://codepen.io/CodingDeer/pen/zYYGOGd

Upvotes: 5

Related Questions