'Vuetify: How to specify the background-color of a selected item in v-select component
I have a v-select widget (combobox / select) in a Vue application. When I open it and hover over an option, the background-color of the option is highlighted (currently light-grey). I want the background-color to have a different color when the mouse arrow hovers over an option. I can not see a property of the v-select widget that supports this. Is there a way to achieve this?
v-select::hover {
background-color: "#00857A";
}
<v-select
append-icon="../assets/img/sy-arrow-chevron-down.svg"
background-color="white"
:height="68"
item-text="label"
item-value="key"
class="mr-3"
v-model="type"
:width="421"
:items="searchCriteria"
@change="performSearch()"
></v-select>
Solution 1:[1]
Add item-color
attribute to v-select
Solution 2:[2]
Define color:
.v-list-item--link::before { background-color: red; }
Define opacity:
.theme--light.v-list-item:hover::before { opacity: 0.64; }
Solution 3:[3]
I guess this is the official way to modify Vuetify: https://next.vuetifyjs.com/en/customization/theme
Solution 4:[4]
Add a style for listitem on hover:
div.v-select-list div[role=list] div[role=listitem]:hover {
background-color:#00857A;
}
and the background of the selected option will be colored darkgreen
Solution 5:[5]
Maybe this can help you, it worked for me
.theme--light.v-text-field--solo > .v-input__control > .v-input__slot {
background:#9d2449 !important;
color: white !important;
}
.theme--light.v-label {
color: rgb(252, 252, 252);
}
.theme--light.v-select .v-select__selection--comma {
color: rgba(255, 255, 255, 0.87);
}
Solution 6:[6]
Use :
::v-deep to access the css.
::v-deep .v-list-item--link::before { background-color: red; }
::v-deep .theme--light.v-list-item:hover::before { opacity: 0.64; }
Solution 7:[7]
Just add bg-color
prop to your v-select
.
<v-select
name="foo"
label="foo"
:items="['foo', 'bar']"
bg-color="red"
/>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | K?nan R?c?bli |
Solution 2 | |
Solution 3 | Marc |
Solution 4 | Marc |
Solution 5 | Yair_May |
Solution 6 | Viktor Blomstergren |
Solution 7 | Nats |