design-infraGitHub
Report a problem or share feedback← Catalog

Icon Swap Button

curatedfree

microkit/icon-swap-button

A leading icon slides out as an arrow opens in to take its place, trading without changing the button's width.

hover — subtlerecipeRefinedMinimal
$npx shadcn@latest add https://microkit.co/r/icon-swap-button.json

npm deps: lucide-react

Our notes

On hover/focus-visible the leading icon (an Apple mark in the demo) collapses out while an arrow opens in on the other side, so the button never changes width (520ms ease-out transitions on width/margin/opacity). Great for download/CTA buttons. No reduced-motion guard; light-dark() hex colours.
Source
MicroKit
Kind
component
Categories
button
Use as
recipe — technique you apply to your own markup
Applies to
buttoncta
Motion
on hover · subtle · css · low cost · ignores reduced motion
Tags
css, hover, hard-coded-colours
Licence
MIT ("MIT License — Copyright (c) 2026 Henrique Barone", github.com/henriquegpb/microkit). README credits note that some interactions are adapted from publicly shared examples and Webflow exports.
Live demo
microkit.co
Docs
microkit.co