Morphing X
A plus that morphs and spins into an X on hover, and presses in on click. The classic 'close' with personality.
Five animated close (X) buttons, morphing, dissolving, magnetic and more. Hover and click each one, then copy the React and Tailwind code. No dependencies, free for any UI.
The close button is one of the most-used controls in any interface, on modals, toasts, banners and drawers. A tiny, thoughtful animation on dismiss makes the whole product feel considered, while keeping the control obvious and accessible. Each button below uses a real, labelled button element so it stays keyboard and screen-reader friendly.
A plus that morphs and spins into an X on hover, and presses in on click. The classic 'close' with personality.
An X made of dots that scatter apart on hover then snap back, like it's dissolving and reforming.
An X ringed by an SVG circle that draws itself and spins on hover, with a gradient stroke.
The X is magnetically pulled toward your cursor, with a glow that follows the pointer. Snaps back on leave.
The two strokes of the X draw themselves in on hover, like being sketched, using SVG stroke-dash.
Yes. Copy the code under any design into your own projects, including commercial ones.
Each uses a real button with an aria-label of 'close', so screen readers announce it correctly and it's keyboard-focusable.
No. Every design is React plus Tailwind with pure CSS or SVG animation, and no external dependencies.
Modals, dialogs, toasts, drawers, banners, anywhere you need a dismiss control. Pick the animation that fits your product's tone.
Yes. Drop the button into your modal or drawer header and wire its onClick to your close handler. The animation is purely visual, so it doesn't affect how you manage open state.
These micro-interactions are the kind of details I build into every project. Built by Saurabh Bhayana, web developer and SEO specialist.
Let's talk →