Git Graph
GitGraphIcon is an animated Git graph icon that draws three commit nodes and their connecting branch lines with motion on hover. It can also be controlled imperatively through a ref with startAnimation and stopAnimation.


shadcn add · no workarounds · theme neutral (none shipped)Installation
Usage
import { GitGraphIcon } from '@/components/ui/git-graph'export function Example() { return <GitGraphIcon className='text-foreground' size={28} />}- Showing version control, branching, repository, or commit concepts in a developer tool, changelog, or documentation UI.
- Adding a lively hover effect to a feature card, sidebar item, or navigation link that relates to Git or deployment.
- Replacing a static Git icon when you want a subtle, playful micro-interaction without a heavy animation library.
- Triggering the animation programmatically (for example on page load or when a pipeline starts) through a ref.
Examples
Hover to animate inside a link
The default uncontrolled mode plays the animation on mouse enter and reverses it on mouse leave.
import { GitGraphIcon } from '@/components/ui/git-graph'export function RepoLink() { return ( <a href='/repositories' className='inline-flex items-center gap-2 text-sm font-medium'> <GitGraphIcon className='text-primary' size={20} /> Repositories </a> )}Controlled animation via ref
Use useRef with GitGraphIconHandle to start or stop the animation from code. When a ref is attached, hover no longer triggers the animation and only the optional onMouseEnter and onMouseLeave callbacks are called.
import { useRef } from 'react'import { GitGraphIcon, type GitGraphIconHandle } from '@/components/ui/git-graph'export function SyncButton() { const iconRef = useRef<GitGraphIconHandle>(null) return ( <button type='button' onMouseEnter={() => iconRef.current?.startAnimation()} onMouseLeave={() => iconRef.current?.stopAnimation()} className='inline-flex items-center gap-2 rounded-md border px-3 py-2' > <GitGraphIcon ref={iconRef} size={18} /> Sync branches </button> )}Start animation when a process begins
Call startAnimation from an effect or event handler to play the animation without user hover.
import { useEffect, useRef } from 'react'import { GitGraphIcon, type GitGraphIconHandle } from '@/components/ui/git-graph'export function DeployStatus({ isDeploying }: { isDeploying: boolean }) { const iconRef = useRef<GitGraphIconHandle>(null) useEffect(() => { if (isDeploying) { iconRef.current?.startAnimation() } else { iconRef.current?.stopAnimation() } }, [isDeploying]) return <GitGraphIcon ref={iconRef} size={32} className='text-emerald-500' />}API reference
Accessibility
- The SVG has no title, desc, or role, so screen readers may ignore it or announce nothing. If the icon conveys meaning, pass aria-label and role='img' through props to the wrapping div.
- If the icon is purely decorative next to visible text, pass aria-hidden='true' so it is hidden from assistive technology.
- The animation is motion only and does not change the content. Respect reduced-motion preferences by avoiding automatic startAnimation calls when the user has prefers-reduced-motion enabled.
- Hover-only animation gives no feedback to keyboard users. Trigger startAnimation on focus as well when the icon is part of an interactive control.
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 "Git Graph" component (lucide-animated/git-graph) from its shadcn registry.1. Install it with: npx shadcn@latest add https://lucide-animated.com/r/git-graph.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 { GitGraphIcon } from '@/components/ui/git-graph'export function Example() { return <GitGraphIcon className='text-foreground' size={28} />}```Files & dependencies
- git-graph.tsx