Calendar Cog

An animated calendar-with-settings icon built on motion/react and forwardRef, where a gear-like cluster of teeth in the lower-right corner rotates 180 degrees on hover or via an imperative handle. It renders a div wrapper around an inline SVG and is intended as a drop-in replacement for a static calendar-cog icon.

Calendar Cog
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/calendar-cog.json

Usage

usage.tsx
import { CalendarCogIcon } from "@/components/ui/calendar-cog";export default function Example() {  return <CalendarCogIcon />;}
  • Settings, scheduling configuration, or calendar preference screens where a calendar with a gear communicates 'calendar settings'.
  • Navigation items or toolbar buttons that open date or availability configuration and benefit from a hover motion cue.
  • Imperative-control scenarios where a parent component should start or stop the cog animation, for example while a background sync runs.
  • Marketing or onboarding UI that wants a subtle, playful animated icon instead of a static SVG.

Examples

Basic hover icon

Renders the icon at the default 28px size; the cog rotates on mouse enter and returns on mouse leave.

basic-hover-icon.tsx
import { CalendarCogIcon } from "@/components/ui/calendar-cog";export default function BasicExample() {  return <CalendarCogIcon className="text-foreground" />;}

Icon inside a settings button

Places the animated icon next to a label inside a button, with a custom size and muted color.

icon-inside-a-settings-button.tsx
import { CalendarCogIcon } from "@/components/ui/calendar-cog";export default function SettingsButton() {  return (    <button type="button" className="inline-flex items-center gap-2 text-sm">      <CalendarCogIcon size={20} className="text-muted-foreground" />      Calendar settings    </button>  );}

Imperative control via ref

Uses the ref handle to start the cog animation when a sync begins and stop it when the sync finishes.

imperative-control-via-ref.tsx
import { useRef } from "react";import { CalendarCogIcon, type CalendarCogIconHandle } from "@/components/ui/calendar-cog";export default function SyncIndicator() {  const iconRef = useRef<CalendarCogIconHandle>(null);  return (    <div      onMouseEnter={() => iconRef.current?.startAnimation()}      onMouseLeave={() => iconRef.current?.stopAnimation()}    >      <CalendarCogIcon ref={iconRef} size={24} />    </div>  );}

API reference

PropTypeDefaultDescription
sizenumber28Width and height of the SVG in pixels. Applied to both the svg width and height attributes.
classNamestring—Class names applied to the outer div wrapper, passed through cn(className).
onMouseEnter(e: React.MouseEvent<HTMLDivElement>) => void—Mouse enter handler. Called by the component when a ref handle is attached (controlled mode); otherwise the animation starts automatically and this handler is not invoked by the component.
onMouseLeave(e: React.MouseEvent<HTMLDivElement>) => void—Mouse leave handler. Called in controlled mode after a ref handle is attached; otherwise the animation returns to rest automatically and this handler is not invoked by the component.
refReact.Ref<CalendarCogIconHandle>—Forwarded ref exposing startAnimation() and stopAnimation(). Attaching it switches the component into controlled mode, disabling automatic hover animation.
...propsHTMLAttributes<HTMLDivElement>—All other standard div attributes (id, style, aria-*, role, data-*, etc.) are spread onto the outer wrapper div.

Accessibility

  • The icon is decorative SVG with no title, desc, or role; if it conveys meaning, pass aria-label and role="img" via props on the wrapper, or place adjacent visible text.
  • When the icon is the only content of an interactive control, the surrounding button must provide an accessible name such as aria-label="Calendar settings".
  • The hover animation is purely visual; do not rely on it to communicate state, and keep the animation subtle so it does not distract users with vestibular sensitivity.
  • Because the wrapper is a div with mouse handlers, keyboard users do not trigger the hover animation; provide focus-visible styling on the parent interactive element instead.

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 "Calendar Cog" component (lucide-animated/calendar-cog) from its shadcn registry.1. Install it with: npx shadcn@latest add https://lucide-animated.com/r/calendar-cog.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 { CalendarCogIcon } from "@/components/ui/calendar-cog";export default function Example() {  return <CalendarCogIcon />;}```

Files & dependencies

  • calendar-cog.tsx
dependenciesmotion

Looks similar, elsewhere