I'm new to Vuetify and would like to make something like this. Basically I have a navigation drawer as a side bar and I want to be able to change the background-color of one of the list on hover as well when selected. Vuetify documentation doesn't seem to discuss this. And I've been looking everywhere, any help will be appreciated.
To set background color with Vuetify, we can add our own theme colors. import Vue from "vue"; import Vuetify from "vuetify/lib"; import colors from "vuetify/lib/util/colors"; const vuetify = new Vuetify({ theme: { themes: { light: { primary: colors. purple, secondary: colors. grey.
This can be easily changed. Simply pass a theme property to the Vuetify constructor. You can choose to modify all or only some of the theme properties, with the remaining inheriting from the default. You can also use the pre-defined material colors.
Changing text color and background color is easy with Vuetify, too. For the background color, simply add the name of the required color to the element's class. For text color, just add the color name followed by --text .
The v-list component is used to display information. It can contain an avatar, content, actions, subheaders and much more. Lists present content in a way that makes it easy to identify a specific item in a collection. They provide a consistent styling for organizing groups of text and images.
You can assign the "v-list-tile", which is the bit you want to style, a class and include your css in that. So your v-navigation-drawer html will look like this:
<v-navigation-drawer
dark
permanent
>
<v-list>
<v-list-tile
class="tile"
v-for="item in items"
:key="item.title"
@click=""
>
<v-list-tile-action>
<v-icon>{{ item.icon }}</v-icon>
</v-list-tile-action> //etc....
As you can see I have added the class="tile"
to the "v-list-tile".
Now just add a .tile class to your pages css:
<style scoped>
.tile {
margin: 5px;
border-radius: 4px;
}
.tile:hover {
background: green;
}
.tile:active {
background: yellow;
}
</style>
and that should do the job.
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