dqnamo

Dynamic Button

Buttons 1

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 { CommandIcon } from "@phosphor-icons/react";
import { DynamicButton } from "@/components/ui/dynamic-button";

export default function OpenCommandPalettePrimary() {
  return (
    <div className="flex min-h-screen w-full items-center justify-center bg-white p-8">
      <DynamicButton variant="primary" icon={<CommandIcon aria-hidden="true" size={15} weight="bold" />}>
        Open command palette
      </DynamicButton>
    </div>
  );
}

Dependencies

More by dqnamo

View all
  • Agent Dock

    Agent Dock

    543
  • Animated Banner

    Animated Banner

    342
  • Scroll Fade List

    Scroll Fade List

    301
  • Model Selector Prompt

    Model Selector Prompt

    155
  • Game of Life Loader

    Game of Life Loader

    129
  • Animated Signature

    Animated Signature

    56
  • Iridescent Foil

    Iridescent Foil

    53
  • Scramble Text

    Scramble Text

    33

More in Buttons

View all
  • Button

    Button

    1
  • Texture Button

    Texture Button

    97
  • Eclipse Button

    Eclipse Button

    39
  • App Store Button

    App Store Button

    458
  • HeroUI Button Group

    HeroUI Button Group

    2
  • Button

    Button

    4
  • Button

    Button

    65
  • Button

    Button

    68