pause
An animated pause icon for React built on motion/react. Hovering the wrapper nudges the two vertical bars of the pause symbol, and a ref handle lets you trigger the animation programmatically.
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 { PauseIcon } from "@/components/ui/pause";export function Example() { return <PauseIcon size={24} className="text-foreground" />;}- Media players or toolbars where a play/pause toggle needs an animated pause state
- Buttons or menu items that suspend a timer, recording, or background process and benefit from a hover cue
- Marketing or dashboard UI that wants a lightweight, icon-sized micro-interaction without writing custom motion code
- Places where you need to control the icon animation from outside (e.g. when a parent component changes state) via the exposed ref
Examples
Hover-triggered pause icon inside a button
Uses the default hover behavior. The wrapper div receives the className and the svg uses currentColor, so color is set via Tailwind text utilities.
import { PauseIcon } from "@/components/ui/pause";import { Button } from "@/components/ui/button";export function PauseButton() { return ( <Button variant="outline" size="icon"> <PauseIcon size={20} /> </Button> );}Programmatic control via ref
Passing a ref switches the component to controlled mode: hover no longer auto-animates, and the parent calls startAnimation and stopAnimation through PauseIconHandle.
import { useRef } from "react";import { Button } from "@/components/ui/button";import { PauseIcon, type PauseIconHandle } from "@/components/ui/pause";export function RecordingControl() { const iconRef = useRef<PauseIconHandle>(null); return ( <Button variant="ghost" onClick={() => iconRef.current?.startAnimation()} onMouseLeave={() => iconRef.current?.stopAnimation()} > <PauseIcon ref={iconRef} size={18} /> Pause recording </Button> );}Reacting to hover in controlled mode
When a ref is attached, the onMouseEnter and onMouseLeave props are forwarded to your handlers instead of running the built-in animation, so you can decide what happens on hover.
import { useRef, useState } from "react";import { PauseIcon, type PauseIconHandle } from "@/components/ui/pause";export function ControlledHover() { const ref = useRef<PauseIconHandle>(null); const [playing, setPlaying] = useState(false); return ( <PauseIcon ref={ref} size={28} className="cursor-pointer" onMouseEnter={() => { if (playing) ref.current?.startAnimation(); }} onMouseLeave={() => ref.current?.stopAnimation()} onClick={() => setPlaying((p) => !p)} /> );}API reference
Accessibility
- The icon is decorative by default: the svg has no title, role, or aria-label, so screen readers may ignore it or read nothing. Add aria-label or role="img" on the wrapper when it conveys meaning on its own, or aria-hidden="true" when a visible text label already exists.
- When used as a button, put the interactive element on a real button and keep the icon inside it, or add role, tabIndex, and keyboard handlers to the wrapper div since the component itself is not focusable.
- The animation is a small 2px movement and does not rely on color, so state is not conveyed by animation alone. Pair it with a text label or aria-pressed when it represents a toggle state.
- Respect reduced motion preferences by disabling or skipping startAnimation calls when prefers-reduced-motion is set, since the component does not check this media query itself.
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 "pause" component (heroicons-animated/pause) from its shadcn registry.1. Install it with: npx shadcn@latest add @heroicons-animated/pause2. 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 { PauseIcon } from "@/components/ui/pause";export function Example() { return <PauseIcon size={24} className="text-foreground" />;}```Files & dependencies
- pause.tsx