paint-brush
An animated paint-brush icon for React, built with motion/react. It rotates gently back and forth on hover, and can also be driven imperatively through a ref.
shadcn add · no workarounds · theme neutral (none shipped)Installation
Requires @heroicons-animated in the registries of your components.json (shadcn adds official directory namespaces automatically).
Usage
import { PaintBrushIcon } from '@/components/ui/paint-brush';export function Example() { return <PaintBrushIcon size={28} className='text-foreground' />;}- Adding a playful, lightly animated paint or creative-tool icon to a navigation item, toolbar, or feature card
- Signalling that a hover or click will apply a styling, theming, or drawing action
- Showing an icon-only control where a subtle motion adds feedback without drawing too much attention
- Triggering the brush animation from code (for example, while a save or generate task runs) through the ref handle
Examples
Basic hover icon
Renders the icon with default size 28. The animation plays on mouse enter and resets on mouse leave.
import { PaintBrushIcon } from '@/components/ui/paint-brush';export default function BasicExample() { return ( <div className='flex items-center gap-2 text-foreground'> <PaintBrushIcon /> <span>Theme editor</span> </div> );}Imperative control via ref
Uses the forwarded ref to start and stop the animation from code. Because a ref is attached, the component's own mouse handlers forward events to onMouseEnter and onMouseLeave instead of animating automatically.
import { useRef } from 'react';import type { PaintBrushIconHandle } from '@/components/ui/paint-brush';import { PaintBrushIcon } from '@/components/ui/paint-brush';export default function ImperativeExample() { const iconRef = useRef<PaintBrushIconHandle>(null); return ( <button type='button' aria-label='Apply style' onMouseEnter={() => iconRef.current?.startAnimation()} onMouseLeave={() => iconRef.current?.stopAnimation()} className='inline-flex items-center justify-center rounded-md p-2 hover:bg-accent' > <PaintBrushIcon ref={iconRef} size={24} /> </button> );}Icon button with larger size
Places the icon inside a button with a larger size and an accessible label. The label is set on the button, since the SVG itself has no text alternative.
import { PaintBrushIcon } from '@/components/ui/paint-brush';export default function IconButtonExample() { return ( <button type='button' aria-label='Open paint tools' className='inline-flex h-12 w-12 items-center justify-center rounded-full border text-foreground hover:bg-muted' > <PaintBrushIcon size={32} /> </button> );}API reference
Accessibility
- The SVG has no title, desc, or role, so it is decorative by default. If the icon conveys meaning on its own, pass aria-label and role='img' to the wrapper via props, or put the label on a parent button.
- When used inside an interactive element such as a button or link, give that element an accessible name, because the icon adds no text.
- The motion is a short rotation of about 6 degrees over 0.6 seconds. It is not a flashing or looping effect, but respect the user's reduced-motion preference by avoiding the hover swing or disabling it in your own wrapper where needed.
- Because the animation is hover-only by default, keyboard users get no visual cue. Trigger startAnimation() on focus through the ref if the animation carries information.
- Use a color with sufficient contrast against the background, since the stroke uses currentColor.
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 "paint-brush" component (heroicons-animated/paint-brush) from its shadcn registry.1. Install it with: npx shadcn@latest add @heroicons-animated/paint-brush2. 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 { PaintBrushIcon } from '@/components/ui/paint-brush';export function Example() { return <PaintBrushIcon size={28} className='text-foreground' />;}```Files & dependencies
- paint-brush.tsx