Grip

GripIcon is an animated 3x3 grid-of-dots icon built on motion/react that plays a staggered fade-out and fade-in wave across its nine circles on hover. It can also be driven imperatively via a ref with startAnimation and stopAnimation.

Grip
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/grip.json

Usage

usage.tsx
import { GripIcon } from "@/components/ui/grip";export function Example() {  return <GripIcon />;}
  • Use as a drag handle or reorder affordance in lists, kanban boards, or sortable tables where a subtle hover cue is helpful.
  • Use as an app-launcher or grid-view toggle icon in navigation bars and toolbars.
  • Use when you need a monochrome, theme-aware icon that animates on hover without extra CSS keyframes.
  • Use with the ref handle when the animation should be triggered by parent state or a non-hover event such as a drag start.

Examples

Default hover animation

Renders the icon at the default 28px size. The animation plays automatically on mouse enter and resets on mouse leave.

default-hover-animation.tsx
import { GripIcon } from "@/components/ui/grip";export function DefaultGrip() {  return <GripIcon />;}

Drag handle in a list row

Uses a smaller size and muted text color via className to act as a drag handle beside a list item label.

drag-handle-in-a-list-row.tsx
import { GripIcon } from "@/components/ui/grip";export function SortableRow({ label }: { label: string }) {  return (    <div className="flex items-center gap-2 rounded-md border px-3 py-2">      <GripIcon size={16} className="cursor-grab text-muted-foreground" />      <span>{label}</span>    </div>  );}

Imperative control via ref

Attaches a GripIconHandle ref so the animation is started and stopped from the parent, here on the wrapper's hover instead of the icon's own hover.

imperative-control-via-ref.tsx
import { useRef } from "react";import { GripIcon, type GripIconHandle } from "@/components/ui/grip";export function DragHandle() {  const ref = useRef<GripIconHandle>(null);  return (    <div      onMouseEnter={() => ref.current?.startAnimation()}      onMouseLeave={() => ref.current?.stopAnimation()}    >      <GripIcon ref={ref} size={20} />    </div>  );}

Icon inside a button

Places the icon inside a button so the hover target is the whole button, with aria-label providing the accessible name.

icon-inside-a-button.tsx
import { GripIcon } from "@/components/ui/grip";export function ReorderButton() {  return (    <button      type="button"      aria-label="Reorder items"      className="inline-flex h-9 w-9 items-center justify-center rounded-md hover:bg-accent"    >      <GripIcon size={18} />    </button>  );}

API reference

PropTypeDefaultDescription
sizenumber28Width and height of the SVG in pixels. Applied to both the width and height attributes.
classNamestring—Additional classes merged onto the outer wrapper div via cn(). The wrapper defaults to inline-flex items-center justify-center.
onMouseEnter(e: React.MouseEvent<HTMLDivElement>) => void—Called on mouse enter. When the ref handle is attached (controlled mode), this is invoked instead of the built-in hover animation; otherwise the built-in animation runs and this is not called.
onMouseLeave(e: React.MouseEvent<HTMLDivElement>) => void—Called on mouse leave. In controlled mode (ref attached) this is invoked instead of the built-in reset; otherwise the built-in reset runs and this is not called.
refReact.Ref<GripIconHandle>—Forwarded ref exposing GripIconHandle with startAnimation(): void and stopAnimation(): void. Attaching it switches the component to controlled mode, disabling automatic hover animation.
...propsHTMLAttributes<HTMLDivElement>—All other standard div attributes (id, style, aria-*, data-*, event handlers) are spread onto the outer wrapper div.

Accessibility

  • The SVG has no title or role, so the icon is decorative. When it conveys meaning (for example, a reorder control), place it inside a button or element with aria-label, or pass aria-label and role via the spread div props.
  • Animation is purely decorative opacity change; it does not convey state on its own, so do not rely on it alone to communicate that an item is draggable.
  • Respect the user's reduced-motion preference by disabling startAnimation calls (for example, checking matchMedia("(prefers-reduced-motion: reduce)")) in controlled usage, since the built-in hover animation has no reduced-motion check.
  • When used as an interactive control, make sure the wrapping element is focusable and keyboard-operable, because the component itself does not add tabIndex or key handlers.
  • Color is inherited via currentColor, so ensure sufficient contrast against the background in both light and dark themes.

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

Files & dependencies

  • grip.tsx
dependenciesmotion

Looks similar, elsewhere