I placed v-text-field component inside a toolbar however it takes almost all available space. How can I change the width of this text-field to take less space?
<v-toolbar
dense
>
<v-app-bar-nav-icon></v-app-bar-nav-icon>
<v-toolbar-title>Title</v-toolbar-title>
<v-text-field
hide-details
label="Filled"
placeholder="Search"
filled
rounded
dense
single-line
append-icon="mdi-magnify"
></v-text-field>
<v-btn rounded>Button 1</v-btn>
<v-btn icon>
<v-icon></v-icon>
</v-btn>
<v-btn icon>
<v-icon>mdi-dots-vertical</v-icon>
</v-btn>
</v-toolbar>
To make the v-container full width with Vuetify, we just add the fluid prop. to add the fluid prop to the v-container to make it fill the width of the v-content component.
The v-text directive is a Vue. js directive used to update a element's textContent with our data. It is just a nice alternative to Mustache syntax. First, we will create a div element with id as app and let's apply the v-text directive to this element with data as a message.
The current version of Vuetify does not support Vue 3. Support for Vue 3 will come with the release of Vuetify v3 . When creating a new project, please ensure you selected Vue 2 from the Vue CLI prompts, or that you are installing to an existing Vue 2 project.
Since the toolbar is display:flex
you could use class="shrink"
...
<v-text-field
hide-details
label="Filled"
placeholder="Search"
filled
rounded
dense
single-line
append-icon="mdi-magnify" class="shrink">
</v-text-field>
Demo: https://codeply.com/p/h3Y8u3nK7P
You can do it by css in scoped style:
<style scoped>
/deep/ .v-text-field{
width: 400px;
}
</style>
and for detailed information read Vuetify documentation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With