Skip to content

A compact copy button whose icon morphs into a drawn checkmark while the pill widens to reveal 'Copied' — layout-animated, no layout jump.

  • Framer Motion
  • Layout
  • Clipboard
  • Micro

The full prompt

Show the prompt that defines the layout, motion and design language
Build a "Copy Button Morph" React component.

CONCEPT: A copy-to-clipboard button for code snippets that grows from an icon-only square into a labeled pill on success, then shrinks back.

LAYOUT & CONTENT:
- Next to a short monospaced snippet 'npm i framer-motion' in a cream box with a charcoal border.
- Button: 36px square, charcoal border, copy icon. Success state: cobalt fill, cream check that draws in (pathLength), label 'Copied'.

INTERACTIONS & MOTION:
- Use layout on the button so width changes animate with spring stiffness 500 damping 32.
- Icon swap with AnimatePresence mode='popLayout' (scale 0.5 → 1, rotate -30 → 0).
- Return to idle after 1.6s. Call navigator.clipboard.writeText in a try/catch.

DESIGN SYSTEM (non-negotiable):
- Palette: paper background #FAF9F6, deep charcoal #121212 for text and 1px borders, ONE warm accent: cobalt #1D4ED8 or terracotta #D9534F. Secondary surface #F2EFE8.
- Typography: Swiss / editorial. A tight grotesk for UI (Instrument Sans, Inter Tight or similar) with negative tracking on display sizes; an italic serif (Instrument Serif) used sparingly for one emphasized word.
- NO dark-mode neon, NO glow, NO glassmorphism, NO backdrop blur, NO purple-to-blue gradients, NO emoji icons. Solid fills, hairline rules, honest shadows (hard offset or none).
- Motion: Framer Motion with spring physics (type: "spring", stiffness 300-500, damping 20-35). Animate transform and opacity only. Respect prefers-reduced-motion via useReducedMotion().
- Icons: lucide-react, 1.5px stroke.
- Accessibility: real <button>/<a>/<label> elements, visible focus ring (2px cobalt, 3px offset), keyboard operable, aria attributes where state changes.

OUTPUT: one self-contained React component file (Tailwind CSS v4 utility classes, framer-motion, lucide-react), no external images, default export, ready to paste into a Next.js App Router page with "use client".

How to use this prompt

  1. 1. CopyUse “Copy Claude Prompt” above. It includes the layout, the spring values and the design rules.
  2. 2. Paste into ClaudeAdd your own brand name, copy and colors at the top of the prompt if you like.
  3. 3. Drop it inYou get one file with React, Tailwind and Framer Motion. Install framer-motion and lucide-react.