Hugeicons Animated

Control animations

Start and stop an icon animation from another React control.
1 min read

Pass a ref when the animation must follow a parent button, menu item, or application state. A controlled icon does not start its own hover animation.

Finite and looping gestures#

Keep control accessible#

Pointer events are not enough for a controlled icon. Start the animation on focus and stop it on blur so keyboard users get the same feedback.

Why does hover stop when I pass a ref?

The ref marks the icon as controlled. This prevents the icon wrapper and the parent control from starting the same animation twice.

Can I start the animation after an async action?

Yes. Call startAnimation() after the action succeeds. The icon will still follow the device's reduced-motion preference.

Can I stop a finite animation early?

No. Finite gestures finish their current beat. This keeps the motion clear and prevents an icon from stopping between poses.

Built with Docs7