Build a Button Micro-Interaction Showcase with Ripple, Magnetic Hover and Checkmark

You get one self-contained HTML page with three accessible button micro-interactions: ripple, magnetic hover and a success checkmark. Each card has a copyable standalone code snippet.

The prompt

Prompt
Act as a senior front-end engineer and interaction designer. Build "Tactile", a single-page showcase of three button micro-interactions on a dark indigo theme: a ripple press, a magnetic hover, and a save button that morphs into a success checkmark. Each interaction gets its own card with a title, a one-line description, a live demo stage, a short how-to line, and a Show code toggle. The toggle reveals minimal standalone HTML, CSS and JS for that effect alone. Add a Copy button that falls back to selecting the text.

Rules:
1. Every effect works with mouse, touch and keyboard. The ripple spawns at the pointer, or from the center on Enter or Space. The magnetic button follows the pointer within 18px, drifts with the arrow keys when focused, and resets on Escape or blur. The save button shows a spinner, draws a checkmark, then resets after 2 seconds.
2. Use pointer events, real button elements, clear focus-visible outlines and an aria-live status line in every card.
3. Layout: a responsive card grid that works from 360px to 1280px wide, a header with a legend of controls, a system font stack, and a four-color palette with AA contrast.
4. Respect prefers-reduced-motion: no magnetic movement, ripples fade instead of scaling, and the spinner turns slower.
5. No external libraries, fonts, images, storage or network calls.

Output format: one complete HTML file in a single code block, then 3 short ideas to extend it.

Example output

One HTML file. Save it and open it in any browser.Open full screen

Example: Tactile, a button micro-interaction lab with three live cards.

  • Ripple: click or tap Send invite and a wave spreads from where you pressed. Tab to it and press Enter or Space to send the ripple from the center.
  • Magnetic hover: move near Get early access and it leans toward you. With keyboard focus, use the arrow keys, and press Esc to reset.
  • Success checkmark: Save changes shrinks into a spinner, then draws a check.

Open Show code on any card to copy a minimal standalone version of that effect.

Written by AI from this prompt. Your results will vary.

Tips and common edits

Why this works

  • Pointer events cover mouse and touch with one code path, and explicit key handlers give keyboard users the same feedback.
  • State lives in a data-state attribute, so CSS handles the morph and checkmark draw without fragile timing code.
  • Each card's snippet is trimmed to the bare effect, so it can be copied into another project and still run.

Paste into ChatGPT, Claude or Gemini. Save the code as tactile.html and open it in any browser, or run it in the chat's preview or canvas. Then tab through the buttons to test keyboard support.

Common edits

  • Swap the indigo palette for your brand colors by editing the four CSS variables at the top of the file.
  • Add a soft Web Audio click on press, with a visible mute toggle, or change the 18px magnetic pull range.

Prompt details

By
Prompts-GPT editors
Published

Did this prompt work?

Keep exploring

More in Animations & Effects