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
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
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
Keep exploring
More like this
Build a Gallery of Ten Looping Pure-CSS Loading Spinners in One HTML File
You get a single HTML page showing ten original pure-CSS loading animations in a tidy grid, each with a reveal-and-copy code snippet.
Build an Animated Headline Text Reveal Playground in a Single HTML File
A one-file playground where you type a headline, preview typewriter, letter stagger, mask wipe or scramble reveals, and copy clean code for the chosen effect.
Build an Animated Mesh Gradient Background Generator With CSS Export
Get a single HTML file that animates layered blurred color blobs into a mesh gradient, with live color pickers, speed and blur sliders, and one-click CSS export.
Build an Animated Number Counter and Progress Ring Stats Dashboard in HTML
You get a single HTML stats section where numbers ease up to their targets and SVG progress rings fill on scroll, with an editor panel and screen-reader announcements.
Build an Animated SVG Wave and Liquid Fill Background Generator
A single HTML file that generates layered, seamlessly looping SVG waves with live controls and exports ready-to-use animated SVG and CSS code.
Build Animated SVG Weather Icons With Size and Color Controls in One HTML File
You get one HTML file with five animated inline SVG weather icons (sun, rain, snow, storm, wind), live size, stroke and color controls, and static reduced-motion versions.