Git Merge

An animated git-merge icon built on motion/react that draws two commit circles and a merging branch curve with a stroke-drawing animation. It plays on hover by default and can also be controlled imperatively via a ref exposing startAnimation and stopAnimation.

Git Merge
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/git-merge.json

Usage

usage.tsx
import { GitMergeIcon } from "@/components/ui/git-merge";export function Example() {  return <GitMergeIcon className="text-primary" />;}
  • Git or version-control related UI such as merge, branch, or pull request actions in dashboards and docs
  • Animated icon buttons or feature highlights where a subtle hover animation adds emphasis
  • Step-by-step or status indicators where the animation should be triggered programmatically via ref
  • Navigation items or menu entries that represent merging or combining workflows

Examples

Hover-triggered icon in a button

Uses the icon inside a button so it animates on hover of the wrapper div, with color from Tailwind classes.

hover-triggered-icon-in-a-button.tsx
import { GitMergeIcon } from "@/components/ui/git-merge";export function MergeButton() {  return (    <button className="inline-flex items-center gap-2 rounded-md border px-3 py-2 text-sm">      <GitMergeIcon size={16} className="text-foreground" />      Merge branch    </button>  );}

Programmatic control via ref

Passes a ref to start and stop the animation imperatively, for example when a merge job begins and ends.

programmatic-control-via-ref.tsx
import { useRef } from "react";import { GitMergeIcon, type GitMergeIconHandle } from "@/components/ui/git-merge";export function MergeStatus() {  const iconRef = useRef<GitMergeIconHandle>(null);  return (    <div      onMouseEnter={() => iconRef.current?.startAnimation()}      onMouseLeave={() => iconRef.current?.stopAnimation()}    >      <GitMergeIcon ref={iconRef} size={32} className="text-emerald-500" />    </div>  );}

Custom hover handlers

Once a ref is attached, the component's internal hover animation is disabled and the onMouseEnter and onMouseLeave props are forwarded to the consumer instead.

custom-hover-handlers.tsx
import { useRef } from "react";import { GitMergeIcon, type GitMergeIconHandle } from "@/components/ui/git-merge";export function NavItem() {  const ref = useRef<GitMergeIconHandle>(null);  return (    <GitMergeIcon      ref={ref}      size={20}      className="cursor-pointer"      onMouseEnter={() => ref.current?.startAnimation()}      onMouseLeave={() => ref.current?.stopAnimation()}    />  );}

API reference

PropTypeDefaultDescription
sizenumber28Width and height of the SVG in pixels.
classNamestring—Class names applied to the wrapping div, merged via cn().
onMouseEnter(e: React.MouseEvent<HTMLDivElement>) => void—Mouse enter handler. Called by the component only after a ref is attached (controlled mode); otherwise the internal animation runs and this handler is not invoked by the component.
onMouseLeave(e: React.MouseEvent<HTMLDivElement>) => void—Mouse leave handler. Called only in controlled mode (after a ref is attached); otherwise the internal reverse animation runs.
refReact.Ref<GitMergeIconHandle>—Forwarded ref exposing startAnimation() and stopAnimation() to play or reset the animation imperatively.
...propsHTMLAttributes<HTMLDivElement>—All other standard div attributes are spread onto the wrapping div (for example id, style, aria-* attributes, and data-* attributes).

Accessibility

  • The rendered SVG has no title, desc, or role attribute, so it is decorative by default; add aria-hidden="true" when a text label is present nearby.
  • When the icon conveys meaning on its own, wrap it in an element with an accessible name using aria-label or visually hidden text, and pass role="img" via the spread div props.
  • Because the animation runs on hover only, make sure the same information is available without hovering and do not rely on the animation alone to communicate state.
  • Respect reduced-motion preferences by wrapping the trigger logic in a check for prefers-reduced-motion if the animation is used in non-essential contexts; the component itself does not read this media query.
  • When the icon is inside an interactive element such as a button or link, the interactive element must carry the accessible name, since the div and SVG are not focusable.

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 "Git Merge" component (lucide-animated/git-merge) from its shadcn registry.1. Install it with: npx shadcn@latest add https://lucide-animated.com/r/git-merge.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 { GitMergeIcon } from "@/components/ui/git-merge";export function Example() {  return <GitMergeIcon className="text-primary" />;}```

Files & dependencies

  • git-merge.tsx
dependenciesmotion

Looks similar, elsewhere