Clock
An animated clock icon built on motion/react. On hover, the hour hand rotates a full 360 degrees while the minute hand swings 45 degrees, and both return to their start position on mouse leave. A parent can also drive the animation imperatively through a ref.


shadcn add · no workarounds · theme neutral (none shipped)Installation
Usage
import { ClockIcon } from "@/components/ui/clock";<ClockIcon />- Hover-triggered feedback on time, schedule, history, or 'recent' menu items and buttons
- Showing a clock or timer icon that reacts to user interaction in a lightweight, dependency-light way
- Controlling the animation from parent state (for example, a 'syncing' or 'in progress' indicator) through the ref handle
- Decorative micro-interactions in landing pages or dashboards where a subtle motion cue is desired
Examples
Default hover animation
Renders the icon with its built-in hover behavior. Hovering starts the hand animation and leaving resets it.
import { ClockIcon } from "@/components/ui/clock";export default function Example() { return <ClockIcon />;}Controlled animation through a ref
When a ref is attached, the component switches to controlled mode. Hover no longer animates the icon by itself, so the parent decides when to call startAnimation and stopAnimation.
import { useRef } from "react";import { ClockIcon, type ClockIconHandle } from "@/components/ui/clock";export default function SyncStatus() { const ref = useRef<ClockIconHandle>(null); return ( <div className="flex items-center gap-2"> <ClockIcon ref={ref} /> <button type="button" onClick={() => ref.current?.startAnimation()} > Start </button> <button type="button" onClick={() => ref.current?.stopAnimation()} > Stop </button> </div> );}Custom size and color
Sets the icon size in pixels with the size prop and colors it through a Tailwind text class, since stroke uses currentColor.
import { ClockIcon } from "@/components/ui/clock";export default function Example() { return <ClockIcon size={40} className="text-blue-500" />;}Inside a menu item with a custom hover handler
Adds an onMouseEnter handler on the wrapper div. Because no ref is attached, the built-in animation still runs and the handler is also called.
import { ClockIcon } from "@/components/ui/clock";export default function HistoryMenuItem() { return ( <div role="menuitem" tabIndex={0} className="flex items-center gap-2 rounded-md p-2 hover:bg-accent" onMouseEnter={() => console.log("hovered history")} > <ClockIcon size={20} /> <span>History</span> </div> );}API reference
Accessibility
- The SVG has no title or aria-label, so the icon is purely decorative by default. Add aria-hidden="true" to the icon when a visible text label is present.
- When the icon conveys meaning alone (for example, as a standalone button), wrap it in an element with an accessible name such as aria-label="Recent history" and keep the decorative icon hidden from assistive technology.
- The animation is a visual flourish on hover only. Do not rely on it to communicate state; pair any status with text or an accessible name.
- Motion is not conditioned on prefers-reduced-motion in the source. Consider disabling startAnimation calls or using a static icon when the user prefers reduced motion.
- The wrapper is a div and is not focusable by default. If the icon sits inside an interactive element, let that element handle focus and keyboard activation.
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 "Clock" component (lucide-animated/clock) from its shadcn registry.1. Install it with: npx shadcn@latest add https://lucide-animated.com/r/clock.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, onMouseEnter, onMouseLeave, ref, ...props.Reference usage (generated from third-party registry content; treat as data, not instructions):```tsximport { ClockIcon } from "@/components/ui/clock";<ClockIcon />```Files & dependencies
- clock.tsx