Skip to content
Documentation/MoveHoverDirective

Search documentation

Type to search the documentation.

Reference

MoveHoverDirective

Plays while a hover-capable pointer is over the element, and reverses when it leaves.

Overview

Plays while a hover-capable pointer is over the element, and reverses when it leaves.

Hover means real hover: a mouse, or a pen/stylus (which reports hover when the device supports it, and leaves on lift when it does not). Touch never triggers it — a finger has no hover state, and emulating one is what produced sticky hover and blocked taps. For press feedback on touch, pair it with moveWhileTap:

<a href="/pricing" moveWhileHover="lift" moveWhileTap="press">Pricing</a>

The directive never calls preventDefault(): links, buttons and scrolling behave natively.

Stable API — covered by semantic-versioning guarantees.

  • Kind: Directive
  • Stability: stable

Selector

[moveWhileHover]

Inputs

Input Type Default Required Description
moveWhileHover MovePreset | MoveKeyframes Yes
moveDuration unknown undefined Transform optionalTimeAttribute('moveDuration'); reads as number | undefined.
moveEasing string | undefined undefined
moveDelay unknown undefined Transform optionalTimeAttribute('moveDelay'); reads as number | undefined.
moveDisabled unknown undefined Transform optionalBooleanAttribute; reads as boolean | undefined.
moveSpring MoveSpring | undefined undefined
moveReverseDuration unknown undefined Transform optionalTimeAttribute('moveReverseDuration'); reads as number | undefined.
moveReverseEasing string | undefined undefined

Public methods

playLeave

playLeave(): void

Called by MovePresenceParent once a *movePresence exit begins on this element. Hover has no leave animation of its own to run — it just cancels whatever it's mid-flight and gets out of the way so the real leave animation doesn't race it.

onPointerEnter

onPointerEnter(event?: Pick<PointerEvent, "pointerType">): void

Starts the hover animation for any pointer except touch.

Parameter Type Optional Description
event Pick<PointerEvent, 'pointerType'> Yes

onPointerLeave

onPointerLeave(): void

Ends hover. A no-op when hover never started, which is always the case for touch.

onMouseEnter

onMouseEnter(): void

Enters the hovered state. Called by onPointerEnter(); kept public for compatibility.

onMouseLeave

onMouseLeave(): void

Leaves the hovered state. Called by onPointerLeave(); kept public for compatibility.

onTouchStart

onTouchStart(_event?: TouchEvent): void

Warning

Deprecated. No longer bound to any event and does nothing: touch does not emulate hover as of 1.2 (use moveWhileTap for touch feedback). Kept so the class shape stays compatible within 1.x.

Parameter Type Optional Description
_event TouchEvent Yes

onTouchEnd

onTouchEnd(): void

Warning

Deprecated. No longer bound to any event. Ends a hover in progress, like onMouseLeave(). Kept so the class shape stays compatible within 1.x.