'How to change icon on hover effect?
As an user, I want to see tasks checkbox as gray tick on hover and blue tick when checkbox is checked.
<div id="app">
<v-app id="inspire">
<v-container
class="px-0"
fluid
>
<v-checkbox
:off-icon="'mdi-circle-outline'"
:on-icon="'mdi-check-circle'"
v-model="checkbox"
:label="`Checkbox 1: ${checkbox.toString()}`"
></v-checkbox>
</v-container>
</v-app>
</div>
new Vue({
el: '#app',
vuetify: new Vuetify(),
data () {
return {
checkbox: true,
}
},
})
Solution 1:[1]
As already mentioned in comments, you can use v-hover component to achieve it:
<v-hover
v-slot="{ hover }"
>
<v-checkbox
:off-icon="'mdi-circle-outline'"
:on-icon="'mdi-check-circle'"
v-model="checkbox"
:label="`Checkbox 1: ${checkbox.toString()}`"
:color="hover ? 'gray': 'primary'"
/>
</v-hover>
...
data () {
return {
checkbox: true,
}
}
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 | Alexander Shkirkov |
