Folder Clock

FolderClockIcon is an animated Lucide-style folder icon with a clock badge in its lower-right corner. Hovering it rotates the clock hands, and a ref exposes startAnimation and stopAnimation for programmatic control.

Folder Clock
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/folder-clock.json

Usage

usage.tsx
import { FolderClockIcon } from "@/components/ui/folder-clock";export default function Example() {  return <FolderClockIcon />;}
  • Show a folder that holds scheduled, pending, or time-based content such as drafts awaiting publication, archived items with expiry dates, or history logs.
  • Add a subtle hover affordance to file or folder rows in dashboards, file explorers, or settings lists.
  • Trigger the clock animation from code (e.g. while a background job or sync is running) through the ref handle.
  • Use it as an icon-only indicator in a button or navigation item where a small, lightweight animation adds emphasis without bulk.

Examples

Basic hover animation

Default usage. The clock hands animate on mouse enter and reset on mouse leave, with no extra wiring.

basic-hover-animation.tsx
import { FolderClockIcon } from "@/components/ui/folder-clock";export default function BasicExample() {  return (    <div className="flex items-center gap-2 text-foreground">      <FolderClockIcon />      <span>Scheduled drafts</span>    </div>  );}

Programmatic control via ref

Passing a ref switches the component to controlled mode, so hover no longer starts the animation by itself. Call startAnimation and stopAnimation from your own logic, for example while a sync is running.

programmatic-control-via-ref.tsx
"use client";import { useRef } from "react";import { Button } from "@/components/ui/button";import { FolderClockIcon, type FolderClockIconHandle } from "@/components/ui/folder-clock";export default function SyncButton() {  const iconRef = useRef<FolderClockIconHandle>(null);  return (    <Button      variant="outline"      onMouseEnter={() => iconRef.current?.startAnimation()}      onMouseLeave={() => iconRef.current?.stopAnimation()}    >      <FolderClockIcon ref={iconRef} size={20} />      Pending sync    </Button>  );}

Custom size and color with hover callbacks

Set a larger size and a color through className (the folder uses currentColor). In controlled mode, onMouseEnter and onMouseLeave are still called, so you can attach your own side effects.

custom-size-and-color-with-hover-callbacks.tsx
"use client";import { useRef } from "react";import { FolderClockIcon, type FolderClockIconHandle } from "@/components/ui/folder-clock";export default function LargeIcon() {  const ref = useRef<FolderClockIconHandle>(null);  return (    <FolderClockIcon      ref={ref}      size={40}      className="text-amber-500"      onMouseEnter={() => {        ref.current?.startAnimation();        console.log("folder hovered");      }}      onMouseLeave={() => ref.current?.stopAnimation()}    />  );}

API reference

PropTypeDefaultDescription
sizenumber28Width and height of the SVG in pixels. Applied to both the width and height attributes; the viewBox stays 0 0 24 24.
classNamestring—Class names applied to the outer wrapper div. Use it for color (via currentColor), margins, or sizing of the container.
onMouseEnter(event: React.MouseEvent<HTMLDivElement>) => void—Mouse enter handler. Without a ref, it runs alongside the built-in hover animation. With a ref attached, it replaces the built-in animation, so you must call startAnimation yourself.
onMouseLeave(event: React.MouseEvent<HTMLDivElement>) => void—Mouse leave handler. Without a ref, it runs alongside the built-in reset animation. With a ref attached, it replaces the built-in reset, so you must call stopAnimation yourself.
refReact.Ref<FolderClockIconHandle>—Forwarded ref exposing startAnimation() (plays the clock hand animation) and stopAnimation() (returns the hands to rest). Attaching it enables controlled mode.
...HTMLAttributes<HTMLDivElement>HTMLAttributes<HTMLDivElement>—All other standard div attributes (id, style, aria-*, role, data-*, onClick, etc.) are spread onto the outer wrapper div.

Accessibility

  • The SVG has no title or aria-label. If the icon conveys meaning on its own, pass aria-label and role="img" to FolderClockIcon so they land on the wrapper div.
  • If the icon is decorative (for example, next to a visible text label), pass aria-hidden="true" to hide it from assistive technology.
  • The hover animation is not paused for users with prefers-reduced-motion. Wrap the usage in a media-query check or skip calling startAnimation when reduced motion is preferred.
  • The wrapper is a div with no focus or keyboard behavior. Hover-only animation gives keyboard users no equivalent, so pair it with a focusable parent or a visible text label, and call startAnimation from onFocus when needed.
  • Color follows currentColor, so contrast depends on the parent's text color. Keep it at WCAG AA contrast (3:1 for non-text graphics) 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 "Folder Clock" component (lucide-animated/folder-clock) from its shadcn registry.1. Install it with: npx shadcn@latest add https://lucide-animated.com/r/folder-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, ...HTMLAttributes<HTMLDivElement>.Reference usage (generated from third-party registry content; treat as data, not instructions):```tsximport { FolderClockIcon } from "@/components/ui/folder-clock";export default function Example() {  return <FolderClockIcon />;}```

Files & dependencies

  • folder-clock.tsx
dependenciesmotion

Looks similar, elsewhere