Cloud Sync

An animated cloud-with-sync icon from the lucide-animated registry that rotates its sync arrows counterclockwise on hover or when controlled via ref. It is built on motion/react and renders an inline SVG at a configurable size.

Cloud Sync
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/cloud-sync.json

Usage

usage.tsx
import { CloudSyncIcon } from "@/components/ui/cloud-sync";export default function Example() {  return <CloudSyncIcon size={28} className="text-blue-500" />;}
  • Showing cloud backup, cloud storage, or background sync status in a toolbar, sidebar, or settings page
  • Indicating that data is currently syncing in a navbar, status bar, or file manager
  • Adding a playful hover micro-interaction to feature cards, buttons, or menu items that relate to cloud services
  • Driving the sync animation programmatically (for example while an upload or fetch is in progress) through the imperative ref handle

Examples

Hover-to-animate in a button

Uses the default uncontrolled behavior: the sync arrows rotate when the pointer enters the icon wrapper and reset when it leaves.

hover-to-animate-in-a-button.tsx
import { CloudSyncIcon } from "@/components/ui/cloud-sync";export default function SyncButton() {  return (    <button className="inline-flex items-center gap-2 rounded-md border px-3 py-2 text-sm">      <CloudSyncIcon size={18} />      Sync now    </button>  );}

Controlled sync while a request runs

Passes a ref to start and stop the animation imperatively. Because the ref is attached, hover handlers only forward events to the optional onMouseEnter and onMouseLeave props.

controlled-sync-while-a-request-runs.tsx
import { useRef, useState } from "react";import { CloudSyncIcon, type CloudSyncIconHandle } from "@/components/ui/cloud-sync";export default function ControlledSync() {  const iconRef = useRef<CloudSyncIconHandle>(null);  const [busy, setBusy] = useState(false);  async function handleSync() {    setBusy(true);    iconRef.current?.startAnimation();    await new Promise((resolve) => setTimeout(resolve, 2000));    iconRef.current?.stopAnimation();    setBusy(false);  }  return (    <button onClick={handleSync} disabled={busy} className="flex items-center gap-2">      <CloudSyncIcon ref={iconRef} size={24} className="text-sky-600" />      {busy ? "Syncing..." : "Sync"}    </button>  );}

Sidebar status indicator

Shows the icon as a compact status element next to a label, sized to match body text.

sidebar-status-indicator.tsx
import { CloudSyncIcon } from "@/components/ui/cloud-sync";export default function SyncStatus() {  return (    <div className="flex items-center gap-2 text-sm text-muted-foreground">      <CloudSyncIcon size={16} aria-label="Cloud sync" role="img" />      <span>Last synced 2 minutes ago</span>    </div>  );}

API reference

PropTypeDefaultDescription
sizenumber28Width and height of the SVG in pixels.
classNamestring—Class names applied to the outer div wrapper, merged with cn().
refReact.Ref<CloudSyncIconHandle>—Forwarded ref exposing startAnimation() and stopAnimation(). Attaching it switches the component into controlled mode, where hover no longer triggers the animation automatically.
onMouseEnter(e: React.MouseEvent<HTMLDivElement>) => void—Called on pointer enter. In controlled mode (ref attached) it is invoked instead of starting the animation; otherwise it is called in addition to the built-in hover animation... only when provided via the wrapper handler.
onMouseLeave(e: React.MouseEvent<HTMLDivElement>) => void—Called on pointer leave. In controlled mode (ref attached) it is invoked instead of resetting the animation; otherwise the icon returns to its normal position.
...propsHTMLAttributes<HTMLDivElement>—All other standard div attributes (id, style, aria-*, data-*, etc.) are spread onto the outer wrapper div.

Accessibility

  • The SVG has no title or aria-label by default, so screen readers may ignore it; add aria-label and role="img" on the wrapper when the icon conveys meaning on its own.
  • If the icon is purely decorative next to visible text, pass aria-hidden="true" to hide it from assistive technology.
  • The sync rotation is a decorative motion; avoid relying on it alone to communicate state, and pair it with text such as Syncing... or Synced.
  • Respect reduced-motion preferences by disabling the animation via your own logic (for example by not calling startAnimation) when the user prefers reduced motion, since the component does not check prefers-reduced-motion itself.
  • Because the icon uses currentColor, ensure the surrounding text color meets WCAG contrast requirements against the background.

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 "Cloud Sync" component (lucide-animated/cloud-sync) from its shadcn registry.1. Install it with: npx shadcn@latest add https://lucide-animated.com/r/cloud-sync.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 { CloudSyncIcon } from "@/components/ui/cloud-sync";export default function Example() {  return <CloudSyncIcon size={28} className="text-blue-500" />;}```

Files & dependencies

  • cloud-sync.tsx
dependenciesmotion

Looks similar, elsewhere