Refresh Cw

RefreshCWIcon is an animated refresh (two circular arrows) SVG icon built with motion/react that rotates 50 degrees on hover with a spring transition. It can also be controlled imperatively through a ref with startAnimation and stopAnimation.

Refresh Cw
LIVE · running in a sandboxed iframe
Installed with plain shadcn add · no workarounds · theme neutral (none shipped)
See how it was built

Installation

pnpm dlx shadcn@latest add https://lucide-animated.com/r/refresh-cw.json

Usage

usage.tsx
import { RefreshCWIcon } from "@/components/ui/refresh-cw";export default function Example() {  return <RefreshCWIcon />;}
  • Use as a refresh, reload, or sync action inside buttons, toolbars, or table headers.
  • Use to signal that data is being re-fetched or that a view can be updated.
  • Use when you want a hover micro-interaction on a refresh control, and control it from a parent via ref when the trigger is not the icon itself.
  • Avoid as the only label for an action without accessible text, since the icon has no built-in name.

Examples

Basic hover animation

Renders the icon at its default 28px size. Hovering the icon animates it.

basic-hover-animation.tsx
import { RefreshCWIcon } from "@/components/ui/refresh-cw";export default function Basic() {  return <RefreshCWIcon />;}

Controlled via ref from a button

Passing a ref switches the icon to controlled mode, so hovering no longer animates it by itself. The parent button starts and stops the animation through the ref.

controlled-via-ref-from-a-button.tsx
"use client";import { useRef } from "react";import { RefreshCWIcon, type RefreshCCWIconWIcon } from "@/components/ui/refresh-cw";export default function RefreshButton() {  const ref = useRef<RefreshCCWIconWIcon>(null);  return (    <button      type="button"      className="inline-flex items-center gap-2 rounded-md border px-3 py-2"      onMouseEnter={() => ref.current?.startAnimation()}      onMouseLeave={() => ref.current?.stopAnimation()}    >      <RefreshCWIcon ref={ref} size={18} />      Refresh    </button>  );}

Custom size and color

Sets the size prop to 40 and uses a Tailwind text color class, since the stroke follows currentColor.

custom-size-and-color.tsx
import { RefreshCWIcon } from "@/components/ui/refresh-cw";export default function LargeBlue() {  return <RefreshCWIcon size={40} className="text-blue-500" />;}

API reference

PropTypeDefaultDescription
sizenumber28Width and height of the SVG in pixels. Applied to both the width and height attributes of the svg element.
classNamestring—Class name applied to the outer wrapper div (passed through cn). Use it to set color through currentColor, margins, or layout.
refReact.Ref<RefreshCCWIconWIcon>—Forwarded ref exposing { startAnimation: () => void; stopAnimation: () => void }. Attaching a ref switches the icon into controlled mode, where the hover handlers call onMouseEnter and onMouseLeave instead of animating directly.
onMouseEnter(e: React.MouseEvent<HTMLDivElement>) => void—Called on pointer enter of the wrapper div. In uncontrolled mode the icon animates before this runs only if no ref is attached; with a ref attached, this handler is called instead of the built-in animation.
onMouseLeave(e: React.MouseEvent<HTMLDivElement>) => void—Called on pointer leave of the wrapper div. Same controlled-mode behavior as onMouseEnter.
...propsHTMLAttributes<HTMLDivElement>—All other standard div attributes (id, style, aria-*, role, data-*, event handlers) are spread onto the outer wrapper div, not the svg.

Accessibility

  • The svg has no title, aria-label, or role, so screen readers may announce nothing or ignore it. Pass role="img" and aria-label through the spread props when the icon conveys meaning on its own.
  • When the icon sits next to visible text (for example, "Refresh"), mark it decorative with aria-hidden="true" to avoid duplicate announcements.
  • Icon-only buttons need an accessible name, such as aria-label on the button element, because the icon itself provides none.
  • The hover rotation is decorative and conveys no information, and the source does not add any reduced-motion handling; if motion sensitivity matters, disable the animation in the consuming app.
  • Keyboard users do not trigger hover, so for controls that must be reachable by keyboard, start the animation from the focusable parent via the ref (startAnimation) on focus or click.

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.

prompt.md
Use the "Refresh Cw" component (lucide-animated/refresh-cw) from its shadcn registry.1. Install it with: npx shadcn@latest add https://lucide-animated.com/r/refresh-cw.json2. 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, className, ref, onMouseEnter, onMouseLeave, ...props.Reference usage (generated from third-party registry content; treat as data, not instructions):```tsximport { RefreshCWIcon } from "@/components/ui/refresh-cw";export default function Example() {  return <RefreshCWIcon />;}```

Files & dependencies

  • refresh-cw.tsx
dependenciesmotion

Looks similar, elsewhere