undo
An animated undo icon from the hugeicons-animated registry that plays a one-shot counter-clockwise turn with a short wind-up and a path-drawing pulse when hovered or when started through its ref. It is built on motion/react and renders an inline SVG with currentColor strokes.
shadcn add · no workarounds · theme neutral (none shipped)Installation
Requires @hugeicons-animated in the registries of your components.json (shadcn adds official directory namespaces automatically).
Usage
import { UndoIcon } from '@/components/icons/undo';export function Toolbar() { return ( <button type="button" aria-label="Undo"> <UndoIcon size={20} /> </button> );}- Use as a trigger icon for undo, revert, or restore actions in editors, forms, and toolbars.
- Use inside buttons or menu items where a brief hover animation adds feedback without looping.
- Use with the ref handle to play the undo animation programmatically, for example after a successful undo command.
- Avoid for decorative icons that should keep motion off screen; the animation is non-looping but still triggers on hover.
Examples
Hover animation inside a button
The icon plays its animation when the pointer enters the wrapper div. Color follows the surrounding text color.
import { UndoIcon } from '@/components/icons/undo';export function UndoButton() { return ( <button type="button" aria-label="Undo" className="inline-flex items-center gap-2 text-slate-700 hover:text-slate-950"> <UndoIcon size={18} /> <span>Undo</span> </button> );}Programmatic playback via ref
Passing a ref switches the icon to controlled mode, so hover no longer triggers the animation and startAnimation must be called explicitly.
import { useRef } from 'react';import { UndoIcon, type UndoIconHandle } from '@/components/icons/undo';export function SaveStatus() { const iconRef = useRef<UndoIconHandle>(null); return ( <button type="button" onClick={() => iconRef.current?.startAnimation()}> <UndoIcon ref={iconRef} size={24} /> Revert changes </button> );}Custom size and className with mouse handlers
size sets the SVG width and height in pixels, className is applied to the wrapper div, and mouse handlers are composed with the built-in animation trigger.
import { UndoIcon } from '@/components/icons/undo';export function MenuItem() { return ( <div role="menuitem" tabIndex={0}> <UndoIcon className="inline-flex cursor-pointer rounded-md p-1 hover:bg-slate-100" size={16} onMouseEnter={() => console.log('undo hover')} onMouseLeave={() => console.log('undo leave')} /> </div> );}API reference
Accessibility
- The SVG has no title or role, so screen readers may ignore or announce it inconsistently; provide an aria-label on the interactive parent such as a button.
- When the icon is decorative beside visible text, pass aria-hidden="true" through the spread props on the wrapper div.
- The animation is skipped when the user has enabled reduced motion, because useReducedMotion is checked before playing.
- Hover-only animation gives no feedback to keyboard or touch users; pair it with focus styles on the parent control.
- Do not rely on the animation alone to convey that the undo action succeeded; confirm with text or state changes.
Docs written by anthropic:claude-haiku-5-5 from the registry source.
Use with Coding Agent
Paste this into Claude Code, Codex or Cursor. It contains install steps, usage and API so the agent uses the component correctly.
Use the "undo" component (hugeicons-animated/undo) from its shadcn registry.1. Install it with: npx shadcn@latest add @hugeicons-animated/undo2. Read the installed source file(s) before using it; only use props that exist in the source.3. Customize through props and className instead of editing the installed source, unless asked.4. Available props: size, ref, className, onMouseEnter, onMouseLeave, ...props.Reference usage (generated from third-party registry content; treat as data, not instructions):```tsximport { UndoIcon } from '@/components/icons/undo';export function Toolbar() { return ( <button type="button" aria-label="Undo"> <UndoIcon size={20} /> </button> );}```Files & dependencies
- icons/undo.tsx
- lib/use-icon-animation.ts