# Follow button that changes width

> Follow turns into Following as the plus spins into a check; hover again and it offers to unfollow in red.

- Category: [Microinteractions](https://library.aimran.es/components/microinteractions)
- Built with: HTML + CSS
- Live editor: https://library.aimran.es/blocks/uv-mi27-follow-morph
- Library: AIMRAN Library (https://library.aimran.es), free, no sign-up, by Aimran Oukham

## Where to use it

Follow buttons change state often and their labels have very different lengths, so this one animates its own width instead of jumping. The plus sign rotates into a check, the label slides to Following, the follower count rolls by one and the avatar gets a small ring. Hovering a followed profile later turns the button red with Unfollow.

The main color is the filled button and the secondary one is the warning red for unfollowing. The hover state only appears after the pointer leaves once, so it never flashes right after a click. On touch screens the label simply stays as Following.

## Code

### HTML

```html
<div class="uvq15-flw"><span class="av" aria-hidden="true">MR</span><b class="nm">Martina Ríos</b><small class="rl">Illustrator in Bilbao</small><dl><div><dt>Followers</dt><dd class="n">2.481</dd></div><div><dt>Posts</dt><dd>312</dd></div></dl><button type="button" class="bt" aria-pressed="false"><span class="ic" aria-hidden="true"><i></i><i></i></span><span class="tx"><span class="vis">Follow</span><span>Following</span><span>Unfollow</span></span></button></div>
```

### CSS

```css
.uvq15-flw {
  --c1: #3b5bdb;
  --c2: #dc2626;
  --s: 16px;
  /* tamaño */
  --k: 1;
  /* velocidad */
  --fg: #1d1d1f;
  /* texto */
  --bg: #f5f5f7;
  /* fondo */
}

.uvq15-flw {
  font-family: -apple-system,BlinkMacSystemFont,"SF Pro Text","Inter",system-ui,sans-serif;
  font-size: var(--s);
  color: var(--fg);
  -webkit-tap-highlight-color: transparent;
  position: relative;
  border-radius: 1.3em;
  background: color-mix(in srgb,var(--fg) 3%,var(--bg));
  box-shadow: 0 0 0 1px color-mix(in srgb,var(--fg) 10%,transparent),0 1.4em 2.6em -1.8em rgba(0,0,0,.35);
  display: grid;
  justify-items: center;
  width: 15em;
  padding: 1.4em 1.2em 1.2em;
}

.uvq15-flw .av {
  position: relative;
  display: grid;
  place-items: center;
  width: 4.2em;
  height: 4.2em;
  border-radius: 50%;
  font-size: 1.05em;
  font-weight: 800;
  color: #fff;
  background: conic-gradient(from 200deg,#f97316,#ec4899,#8b5cf6,#f97316);
}

.uvq15-flw .av::after {
  content: "";
  position: absolute;
  inset: -.3em;
  border-radius: 50%;
  border: 2px solid var(--c1);
  opacity: 0;
  transform: scale(.8);
}

.uvq15-flw.pop .av {
  animation: uvq15-flw-a calc(0.5s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq15-flw.pop .av::after {
  animation: uvq15-flw-r calc(0.7s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

@keyframes uvq15-flw-a {
  40% {
    transform: scale(1.1);
  }
}

@keyframes uvq15-flw-r {
  30% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: scale(1.35);
  }
}

.uvq15-flw .nm {
  margin-top: .6em;
  font-size: 1.05em;
}

.uvq15-flw .rl {
  font-size: .75em;
  color: color-mix(in srgb,var(--fg) 55%,transparent);
}

.uvq15-flw dl {
  display: flex;
  gap: 1.4em;
  margin: .9em 0 1em;
  text-align: center;
}

.uvq15-flw dt {
  order: 2;
  font-size: .68em;
  color: color-mix(in srgb,var(--fg) 55%,transparent);
}

.uvq15-flw dl div {
  display: flex;
  flex-direction: column;
}

.uvq15-flw dd {
  margin: 0;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.uvq15-flw .bt {
  font: inherit;
  color: inherit;
  border: 0;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  display: flex;
  align-items: center;
  gap: .45em;
  padding: .75em 1.2em;
  border-radius: 2em;
  font-weight: 700;
  color: #fff;
  background: var(--c1);
  box-shadow: inset 0 0 0 1.5px var(--c1);
  transition: background calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1),color calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1),box-shadow calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1),transform .15s cubic-bezier(.25,.1,.25,1);
}

.uvq15-flw .bt:active {
  transform: scale(.96);
}

.uvq15-flw .bt:focus-visible {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
}

.uvq15-flw .ic {
  position: relative;
  flex: none;
  width: .9em;
  height: .9em;
}

.uvq15-flw .ic i {
  position: absolute;
  left: 50%;
  top: 50%;
  width: .9em;
  height: .15em;
  margin: -.075em 0 0 -.45em;
  border-radius: 1em;
  background: currentColor;
  transition: transform calc(0.45s / var(--k)) cubic-bezier(.22,1,.36,1),width calc(0.45s / var(--k)) cubic-bezier(.22,1,.36,1);
}

.uvq15-flw .ic i+i {
  transform: rotate(90deg);
}

.uvq15-flw .tx {
  display: grid;
  overflow: hidden;
  transition: width calc(0.45s / var(--k)) cubic-bezier(.22,1,.36,1);
}

.uvq15-flw .tx span {
  grid-area: 1/1;
  justify-self: start;
  white-space: nowrap;
  visibility: hidden;
  opacity: 0;
  transform: translateY(.6em);
  transition: opacity calc(0.25s / var(--k)) cubic-bezier(.25,.1,.25,1),transform calc(0.35s / var(--k)) cubic-bezier(.22,1,.36,1),visibility 0s calc(0.25s / var(--k));
}

.uvq15-flw .tx .vis {
  visibility: visible;
  opacity: 1;
  transform: none;
  transition-delay: 0s;
}

.uvq15-flw.on .bt {
  color: var(--fg);
  background: transparent;
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb,var(--fg) 10%,transparent);
}

.uvq15-flw.on .ic i {
  width: .42em;
  transform: translate(-.2em,.12em) rotate(45deg);
}

.uvq15-flw.on .ic i+i {
  width: .75em;
  transform: translate(.12em,-.02em) rotate(-50deg);
}

.uvq15-flw.un .bt {
  color: var(--c2);
  box-shadow: inset 0 0 0 1.5px var(--c2);
  background: color-mix(in srgb,var(--c2) 8%,transparent);
}

.uvq15-flw.un .ic i {
  width: .8em;
  transform: rotate(45deg);
}

.uvq15-flw.un .ic i+i {
  width: .8em;
  transform: rotate(-45deg);
}

@media (prefers-reduced-motion:reduce) {
  .uvq15-flw,.uvq15-flw *,.uvq15-flw *::before,.uvq15-flw *::after {
    animation-duration: .01ms!important;
    animation-iteration-count: 1!important;
    transition-duration: .01ms!important;
  }
}
```

### JavaScript

```js
document.querySelectorAll(".uvq15-flw").forEach(el => {
  const k=parseFloat(getComputedStyle(el).getPropertyValue("--k"))||1,rm=matchMedia("(prefers-reduced-motion:reduce)").matches;const bt=el.querySelector(".bt"),tx=bt.querySelector(".tx"),sp=[...tx.children],n=el.querySelector(".n");let on=false,hv=false,fresh=false,c=2481;
const fit=()=>{const i=!on?0:hv&&!fresh?2:1;sp.forEach((s,j)=>s.classList.toggle("vis",j===i));tx.style.width=sp[i].offsetWidth+"px";el.classList.toggle("un",i===2)};
bt.addEventListener("click",()=>{on=!on;fresh=on;bt.setAttribute("aria-pressed",String(on));el.classList.toggle("on",on);c+=on?1:-1;n.textContent=c.toLocaleString("de-DE");
if(!rm)n.animate([{transform:"translateY("+(on?".5em":"-.5em")+")",opacity:0},{transform:"none",opacity:1}],{duration:350/k,easing:"cubic-bezier(.22,1,.36,1)"});el.classList.remove("pop");if(on){void el.offsetWidth;el.classList.add("pop")}fit()});
bt.addEventListener("pointerenter",e=>{if(e.pointerType==="mouse"){hv=true;fit()}});bt.addEventListener("pointerleave",()=>{hv=false;fresh=false;fit()});fit()
});
```

### React

```tsx
// @ts-nocheck: setup() es JavaScript del DOM sin tipos, el mismo de la pestaña JS.
import { useEffect, useRef, type CSSProperties } from "react";

const css = `
.uvq15-flw {
  font-family: -apple-system,BlinkMacSystemFont,"SF Pro Text","Inter",system-ui,sans-serif;
  font-size: var(--s);
  color: var(--fg);
  -webkit-tap-highlight-color: transparent;
  position: relative;
  border-radius: 1.3em;
  background: color-mix(in srgb,var(--fg) 3%,var(--bg));
  box-shadow: 0 0 0 1px color-mix(in srgb,var(--fg) 10%,transparent),0 1.4em 2.6em -1.8em rgba(0,0,0,.35);
  display: grid;
  justify-items: center;
  width: 15em;
  padding: 1.4em 1.2em 1.2em;
}

.uvq15-flw .av {
  position: relative;
  display: grid;
  place-items: center;
  width: 4.2em;
  height: 4.2em;
  border-radius: 50%;
  font-size: 1.05em;
  font-weight: 800;
  color: #fff;
  background: conic-gradient(from 200deg,#f97316,#ec4899,#8b5cf6,#f97316);
}

.uvq15-flw .av::after {
  content: "";
  position: absolute;
  inset: -.3em;
  border-radius: 50%;
  border: 2px solid var(--c1);
  opacity: 0;
  transform: scale(.8);
}

.uvq15-flw.pop .av {
  animation: uvq15-flw-a calc(0.5s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq15-flw.pop .av::after {
  animation: uvq15-flw-r calc(0.7s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

@keyframes uvq15-flw-a {
  40% {
    transform: scale(1.1);
  }
}

@keyframes uvq15-flw-r {
  30% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: scale(1.35);
  }
}

.uvq15-flw .nm {
  margin-top: .6em;
  font-size: 1.05em;
}

.uvq15-flw .rl {
  font-size: .75em;
  color: color-mix(in srgb,var(--fg) 55%,transparent);
}

.uvq15-flw dl {
  display: flex;
  gap: 1.4em;
  margin: .9em 0 1em;
  text-align: center;
}

.uvq15-flw dt {
  order: 2;
  font-size: .68em;
  color: color-mix(in srgb,var(--fg) 55%,transparent);
}

.uvq15-flw dl div {
  display: flex;
  flex-direction: column;
}

.uvq15-flw dd {
  margin: 0;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.uvq15-flw .bt {
  font: inherit;
  color: inherit;
  border: 0;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  display: flex;
  align-items: center;
  gap: .45em;
  padding: .75em 1.2em;
  border-radius: 2em;
  font-weight: 700;
  color: #fff;
  background: var(--c1);
  box-shadow: inset 0 0 0 1.5px var(--c1);
  transition: background calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1),color calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1),box-shadow calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1),transform .15s cubic-bezier(.25,.1,.25,1);
}

.uvq15-flw .bt:active {
  transform: scale(.96);
}

.uvq15-flw .bt:focus-visible {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
}

.uvq15-flw .ic {
  position: relative;
  flex: none;
  width: .9em;
  height: .9em;
}

.uvq15-flw .ic i {
  position: absolute;
  left: 50%;
  top: 50%;
  width: .9em;
  height: .15em;
  margin: -.075em 0 0 -.45em;
  border-radius: 1em;
  background: currentColor;
  transition: transform calc(0.45s / var(--k)) cubic-bezier(.22,1,.36,1),width calc(0.45s / var(--k)) cubic-bezier(.22,1,.36,1);
}

.uvq15-flw .ic i+i {
  transform: rotate(90deg);
}

.uvq15-flw .tx {
  display: grid;
  overflow: hidden;
  transition: width calc(0.45s / var(--k)) cubic-bezier(.22,1,.36,1);
}

.uvq15-flw .tx span {
  grid-area: 1/1;
  justify-self: start;
  white-space: nowrap;
  visibility: hidden;
  opacity: 0;
  transform: translateY(.6em);
  transition: opacity calc(0.25s / var(--k)) cubic-bezier(.25,.1,.25,1),transform calc(0.35s / var(--k)) cubic-bezier(.22,1,.36,1),visibility 0s calc(0.25s / var(--k));
}

.uvq15-flw .tx .vis {
  visibility: visible;
  opacity: 1;
  transform: none;
  transition-delay: 0s;
}

.uvq15-flw.on .bt {
  color: var(--fg);
  background: transparent;
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb,var(--fg) 10%,transparent);
}

.uvq15-flw.on .ic i {
  width: .42em;
  transform: translate(-.2em,.12em) rotate(45deg);
}

.uvq15-flw.on .ic i+i {
  width: .75em;
  transform: translate(.12em,-.02em) rotate(-50deg);
}

.uvq15-flw.un .bt {
  color: var(--c2);
  box-shadow: inset 0 0 0 1.5px var(--c2);
  background: color-mix(in srgb,var(--c2) 8%,transparent);
}

.uvq15-flw.un .ic i {
  width: .8em;
  transform: rotate(45deg);
}

.uvq15-flw.un .ic i+i {
  width: .8em;
  transform: rotate(-45deg);
}

@media (prefers-reduced-motion:reduce) {
  .uvq15-flw,.uvq15-flw *,.uvq15-flw *::before,.uvq15-flw *::after {
    animation-duration: .01ms!important;
    animation-iteration-count: 1!important;
    transition-duration: .01ms!important;
  }
}
`;

// Interacción en JavaScript del DOM: la misma que en la pestaña JS.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function setup(el: any) {
  const k=parseFloat(getComputedStyle(el).getPropertyValue("--k"))||1,rm=matchMedia("(prefers-reduced-motion:reduce)").matches;const bt=el.querySelector(".bt"),tx=bt.querySelector(".tx"),sp=[...tx.children],n=el.querySelector(".n");let on=false,hv=false,fresh=false,c=2481;
const fit=()=>{const i=!on?0:hv&&!fresh?2:1;sp.forEach((s,j)=>s.classList.toggle("vis",j===i));tx.style.width=sp[i].offsetWidth+"px";el.classList.toggle("un",i===2)};
bt.addEventListener("click",()=>{on=!on;fresh=on;bt.setAttribute("aria-pressed",String(on));el.classList.toggle("on",on);c+=on?1:-1;n.textContent=c.toLocaleString("de-DE");
if(!rm)n.animate([{transform:"translateY("+(on?".5em":"-.5em")+")",opacity:0},{transform:"none",opacity:1}],{duration:350/k,easing:"cubic-bezier(.22,1,.36,1)"});el.classList.remove("pop");if(on){void el.offsetWidth;el.classList.add("pop")}fit()});
bt.addEventListener("pointerenter",e=>{if(e.pointerType==="mouse"){hv=true;fit()}});bt.addEventListener("pointerleave",()=>{hv=false;fresh=false;fit()});fit()
}

export default function Mi27FollowMorph() {
  const ref = useRef<HTMLDivElement>(null);

  useEffect(() => {
    const el = ref.current?.firstElementChild;
    return el ? setup(el) : undefined;
  }, []);

  return (
    <>
      <style>{css}</style>
      <div
        ref={ref} style={{
          "--c1": "#3b5bdb",
          "--c2": "#dc2626",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <div className="uvq15-flw"><span className="av" aria-hidden="true">MR</span><b className="nm">Martina Ríos</b><small className="rl">Illustrator in Bilbao</small><dl><div><dt>Followers</dt><dd className="n">2.481</dd></div><div><dt>Posts</dt><dd>312</dd></div></dl><button type="button" className="bt" aria-pressed="false"><span className="ic" aria-hidden="true"><i></i><i></i></span><span className="tx"><span className="vis">Follow</span><span>Following</span><span>Unfollow</span></span></button></div>
      </div>
    </>
  );
}
```

## Prompt for AI assistants

Paste this into ChatGPT, Claude, Cursor, v0 or Lovable to adapt the block to your stack (Tailwind, Vue, Svelte…):

````text
I want to add the “Follow button that changes width” block (Microinteractions) from AIMRAN Library to my project.

## What it is
Follow turns into Following as the plus spins into a check; hover again and it offers to unfollow in red.

## Chosen settings
- Main color: #3b5bdb
- Secondary color: #dc2626
- Size: 16px (from 12 to 24px)
- Speed: 1x (from 0.5 to 2x)
- Text: "Seguir"

## What I need
1. Add it to my project with the same look and animation as the reference code: same sizes, colours, radii, shadows, timings and easing.
2. It is built with plain HTML and CSS (the reference wraps it in a React component with its CSS). If my project uses something else (Vue, Svelte, Astro, plain HTML…), translate it without losing any behaviour. If I use Tailwind, turn the styles into classes; if not, keep the CSS in its own file.
3. Expose the settings above as props (or CSS variables) with those values as defaults.
4. Make it work well on phones: nothing that depends only on hover, touch targets of at least 44 px and no overflow on 320 px screens.
5. Make it look right in light and dark mode.
6. Keep it accessible: semantic HTML, roles and aria-* where needed, visible focus and keyboard support.
7. Respect prefers-reduced-motion: with reduced motion, no big animations but the same end result.

## Reference code
```tsx
// @ts-nocheck: setup() es JavaScript del DOM sin tipos, el mismo de la pestaña JS.
import { useEffect, useRef, type CSSProperties } from "react";

const css = `
.uvq15-flw {
  font-family: -apple-system,BlinkMacSystemFont,"SF Pro Text","Inter",system-ui,sans-serif;
  font-size: var(--s);
  color: var(--fg);
  -webkit-tap-highlight-color: transparent;
  position: relative;
  border-radius: 1.3em;
  background: color-mix(in srgb,var(--fg) 3%,var(--bg));
  box-shadow: 0 0 0 1px color-mix(in srgb,var(--fg) 10%,transparent),0 1.4em 2.6em -1.8em rgba(0,0,0,.35);
  display: grid;
  justify-items: center;
  width: 15em;
  padding: 1.4em 1.2em 1.2em;
}

.uvq15-flw .av {
  position: relative;
  display: grid;
  place-items: center;
  width: 4.2em;
  height: 4.2em;
  border-radius: 50%;
  font-size: 1.05em;
  font-weight: 800;
  color: #fff;
  background: conic-gradient(from 200deg,#f97316,#ec4899,#8b5cf6,#f97316);
}

.uvq15-flw .av::after {
  content: "";
  position: absolute;
  inset: -.3em;
  border-radius: 50%;
  border: 2px solid var(--c1);
  opacity: 0;
  transform: scale(.8);
}

.uvq15-flw.pop .av {
  animation: uvq15-flw-a calc(0.5s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq15-flw.pop .av::after {
  animation: uvq15-flw-r calc(0.7s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

@keyframes uvq15-flw-a {
  40% {
    transform: scale(1.1);
  }
}

@keyframes uvq15-flw-r {
  30% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: scale(1.35);
  }
}

.uvq15-flw .nm {
  margin-top: .6em;
  font-size: 1.05em;
}

.uvq15-flw .rl {
  font-size: .75em;
  color: color-mix(in srgb,var(--fg) 55%,transparent);
}

.uvq15-flw dl {
  display: flex;
  gap: 1.4em;
  margin: .9em 0 1em;
  text-align: center;
}

.uvq15-flw dt {
  order: 2;
  font-size: .68em;
  color: color-mix(in srgb,var(--fg) 55%,transparent);
}

.uvq15-flw dl div {
  display: flex;
  flex-direction: column;
}

.uvq15-flw dd {
  margin: 0;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.uvq15-flw .bt {
  font: inherit;
  color: inherit;
  border: 0;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  display: flex;
  align-items: center;
  gap: .45em;
  padding: .75em 1.2em;
  border-radius: 2em;
  font-weight: 700;
  color: #fff;
  background: var(--c1);
  box-shadow: inset 0 0 0 1.5px var(--c1);
  transition: background calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1),color calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1),box-shadow calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1),transform .15s cubic-bezier(.25,.1,.25,1);
}

.uvq15-flw .bt:active {
  transform: scale(.96);
}

.uvq15-flw .bt:focus-visible {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
}

.uvq15-flw .ic {
  position: relative;
  flex: none;
  width: .9em;
  height: .9em;
}

.uvq15-flw .ic i {
  position: absolute;
  left: 50%;
  top: 50%;
  width: .9em;
  height: .15em;
  margin: -.075em 0 0 -.45em;
  border-radius: 1em;
  background: currentColor;
  transition: transform calc(0.45s / var(--k)) cubic-bezier(.22,1,.36,1),width calc(0.45s / var(--k)) cubic-bezier(.22,1,.36,1);
}

.uvq15-flw .ic i+i {
  transform: rotate(90deg);
}

.uvq15-flw .tx {
  display: grid;
  overflow: hidden;
  transition: width calc(0.45s / var(--k)) cubic-bezier(.22,1,.36,1);
}

.uvq15-flw .tx span {
  grid-area: 1/1;
  justify-self: start;
  white-space: nowrap;
  visibility: hidden;
  opacity: 0;
  transform: translateY(.6em);
  transition: opacity calc(0.25s / var(--k)) cubic-bezier(.25,.1,.25,1),transform calc(0.35s / var(--k)) cubic-bezier(.22,1,.36,1),visibility 0s calc(0.25s / var(--k));
}

.uvq15-flw .tx .vis {
  visibility: visible;
  opacity: 1;
  transform: none;
  transition-delay: 0s;
}

.uvq15-flw.on .bt {
  color: var(--fg);
  background: transparent;
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb,var(--fg) 10%,transparent);
}

.uvq15-flw.on .ic i {
  width: .42em;
  transform: translate(-.2em,.12em) rotate(45deg);
}

.uvq15-flw.on .ic i+i {
  width: .75em;
  transform: translate(.12em,-.02em) rotate(-50deg);
}

.uvq15-flw.un .bt {
  color: var(--c2);
  box-shadow: inset 0 0 0 1.5px var(--c2);
  background: color-mix(in srgb,var(--c2) 8%,transparent);
}

.uvq15-flw.un .ic i {
  width: .8em;
  transform: rotate(45deg);
}

.uvq15-flw.un .ic i+i {
  width: .8em;
  transform: rotate(-45deg);
}

@media (prefers-reduced-motion:reduce) {
  .uvq15-flw,.uvq15-flw *,.uvq15-flw *::before,.uvq15-flw *::after {
    animation-duration: .01ms!important;
    animation-iteration-count: 1!important;
    transition-duration: .01ms!important;
  }
}
`;

// Interacción en JavaScript del DOM: la misma que en la pestaña JS.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function setup(el: any) {
  const k=parseFloat(getComputedStyle(el).getPropertyValue("--k"))||1,rm=matchMedia("(prefers-reduced-motion:reduce)").matches;const bt=el.querySelector(".bt"),tx=bt.querySelector(".tx"),sp=[...tx.children],n=el.querySelector(".n");let on=false,hv=false,fresh=false,c=2481;
const fit=()=>{const i=!on?0:hv&&!fresh?2:1;sp.forEach((s,j)=>s.classList.toggle("vis",j===i));tx.style.width=sp[i].offsetWidth+"px";el.classList.toggle("un",i===2)};
bt.addEventListener("click",()=>{on=!on;fresh=on;bt.setAttribute("aria-pressed",String(on));el.classList.toggle("on",on);c+=on?1:-1;n.textContent=c.toLocaleString("de-DE");
if(!rm)n.animate([{transform:"translateY("+(on?".5em":"-.5em")+")",opacity:0},{transform:"none",opacity:1}],{duration:350/k,easing:"cubic-bezier(.22,1,.36,1)"});el.classList.remove("pop");if(on){void el.offsetWidth;el.classList.add("pop")}fit()});
bt.addEventListener("pointerenter",e=>{if(e.pointerType==="mouse"){hv=true;fit()}});bt.addEventListener("pointerleave",()=>{hv=false;fresh=false;fit()});fit()
}

export default function Mi27FollowMorph() {
  const ref = useRef<HTMLDivElement>(null);

  useEffect(() => {
    const el = ref.current?.firstElementChild;
    return el ? setup(el) : undefined;
  }, []);

  return (
    <>
      <style>{css}</style>
      <div
        ref={ref} style={{
          "--c1": "#3b5bdb",
          "--c2": "#dc2626",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <div className="uvq15-flw"><span className="av" aria-hidden="true">MR</span><b className="nm">Martina Ríos</b><small className="rl">Illustrator in Bilbao</small><dl><div><dt>Followers</dt><dd className="n">2.481</dd></div><div><dt>Posts</dt><dd>312</dd></div></dl><button type="button" className="bt" aria-pressed="false"><span className="ic" aria-hidden="true"><i></i><i></i></span><span className="tx"><span className="vis">Follow</span><span>Following</span><span>Unfollow</span></span></button></div>
      </div>
    </>
  );
}
```

Give me the complete final code, ready to paste, and tell me in one line where to put it in my project.
````
