/Click feedback
Click feedback • CSS
Expanding Contact Button
A pill-shaped call-to-action with an expanding background and arrow icon, adapted from the supplied Webflow export.
Installation
Requires lucide-react for its icons. The shadcn CLI installs it for you; copying the code by hand means installing it yourself.
Terminal
npx shadcn@latest add https://microkit.co/r/expanding-contact-button.jsonCode
TypeScript component
1import { ArrowRight } from "lucide-react";23export function ExpandingContactButton() {4return (5<button type="button" className="contact-pill">6<span className="contact-pill-icon" aria-hidden="true">7<ArrowRight size={18} strokeWidth={2.5} />8</span>9<span>Get in touch</span>10</button>11);12}
CSS
1.contact-pill {2position: relative;3display: inline-flex;4align-items: center;5width: 36px;6height: 36px;7gap: 0;8overflow: hidden;9border: 0;10border-radius: 999px;11padding: 0;12background: transparent;13color: #f0f0f0;14font-size: 13px;15font-weight: 500;16line-height: 1;17transition: width .32s cubic-bezier(.4, 0, .2, 1), background-color .32s cubic-bezier(.4, 0, .2, 1), color .28s ease;18}19.contact-pill::before {20content: "";21position: absolute;22inset: 0 auto 0 0;23width: 36px;24height: 36px;25border-radius: 50%;26background: #f97316;27}28.contact-pill-icon,29.contact-pill > span:last-child {30position: relative;31z-index: 1;32}33.contact-pill-icon {34display: grid;35place-items: center;36width: 36px;37height: 36px;38color: #111;39}40.contact-pill > span:last-child {41position: absolute;42left: 47px;43white-space: nowrap;44opacity: 0;45transform: translateX(-5px);46transition: opacity .18s ease .1s, transform .24s ease .06s;47}48.contact-pill:hover,49.contact-pill:focus-visible {50width: 145px;51background: #f4f4f5;52color: #111;53}54.contact-pill:hover > span:last-child,55.contact-pill:focus-visible > span:last-child {56opacity: 1;57transform: translateX(0);58}59.contact-pill:focus-visible {60outline: 2px solid #f97316;61outline-offset: 4px;62}