dqnamo

Dynamic Button

Buttons 4

About

An animated button that smoothly resizes its width to fit new content and crossfades its label and icon whenever the action or state changes. Built with motion/react, it uses a spring width transition, a coordinated vertical fade for content swaps, and an active-press scale. Supports primary and secondary variants, an optional icon, content or full width, and respects reduced-motion preferences.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Dynamic Button to your project and fits it to your theme.

Code

How Dynamic Button is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

"use client";

import { SpinnerIcon } from "@phosphor-icons/react";
import { DynamicButton } from "@/components/ui/dynamic-button";

export default function ProcessingSecondary() {
  return (
    <div className="flex min-h-screen w-full items-center justify-center bg-white p-8">
      <DynamicButton variant="secondary" icon={<SpinnerIcon aria-hidden="true" className="animate-spin" size={15} weight="bold" />}>
        Processing
      </DynamicButton>
    </div>
  );
}

Dependencies

More by dqnamo

View all
  • Agent Dock

    Agent Dock

    581
  • Animated Banner

    Animated Banner

    370
  • Scroll Fade List

    Scroll Fade List

    306
  • Model Selector Prompt

    Model Selector Prompt

    173
  • Game of Life Loader

    Game of Life Loader

    143
  • Animated Signature

    Animated Signature

    69
  • Iridescent Foil

    Iridescent Foil

    60
  • Scramble Text

    Scramble Text

    41

More in Buttons

View all
  • Button

    Button

    20
  • Button

    Button

    3
  • Button Group

    Button Group

    18
  • Button

    Button

    149
  • Icon Label Subtext Button

    Icon Label Subtext Button

    69
  • Button

    Button

    9
  • Button

    Button

    37
  • Texture Button

    Texture Button

    113