v-hover
Directive
Toggles a CSS class on an element while the pointer is over it. Supports a callback mode (.callback modifier) and propagation stop (.stop modifier).
API
Value / Arguments
Shape of the binding value and each property in the options object.
- valueboolean | { class: string }
- Pass false to disable the directive. Pass { class } to specify the CSS class added while the pointer is over the element.
API
Modifiers
Dot-suffix modifiers that alter the directive behaviour.
- .callback
- When present, the directive value is treated as a function (isHovered: boolean) => void instead of a class object.
- .stop
- Calls stopPropagation() on the underlying pointer events, preventing parent hover handlers from triggering.
Usage
Examples
Ready-to-paste code snippets for your templates.
Class toggle on hover
Callback mode