Skip to content

Animated Gradient Button

Smooth animated gradient that flows continuously

Animated Gradient Button

by FreeCsStyles Dev's

Gradient EffectsModern
🌐🎨⚛️💚🅰️🔥☁️
#gradient#animated#colorful#cta#primary#flow

Embed this component

Paste this snippet into any site — the design renders in a sandboxed iframe served from /embed/gradient-button.

<iframe src="/embed/gradient-button" sandbox="allow-scripts" loading="lazy" title="Animated Gradient Button" style="border:0;width:100%;height:480px;overflow:hidden"></iframe>

Implementation code

Copy the HTML and CSS for Animated Gradient Button, or grab a framework-specific implementation. The HTML and CSS variants are self-contained; framework variants assume that framework's project setup.

HTML
<button class="gradient-button">Gradient Button</button>
CSS
.gradient-button {
  padding: 1rem 2rem;
  border-radius: 0.75rem;
  background: linear-gradient(90deg, #a855f7, #ec4899, #06b6d4, #a855f7);
  background-size: 200% 200%;
  color: white;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  animation: gradient-shift 3s ease infinite;
}

.gradient-button:hover {
  box-shadow: 0 20px 40px rgba(168, 85, 247, 0.5);
}

@keyframes gradient-shift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
Tailwind CSS
<button class="px-8 py-4 rounded-xl bg-gradient-to-r from-purple-500 via-pink-500 to-cyan-500 text-white font-semibold hover:shadow-2xl hover:shadow-purple-500/50 transition-all" style="background-size: 200% 200%; animation: gradient-shift 3s ease infinite;">
  Gradient Button
</button>
LWC — HTML template
<template>
  <button class="gradient-button" onclick={handleClick}>
    <slot>Gradient Button</slot>
  </button>
</template>
LWC — JavaScript
import { LightningElement, api } from 'lwc';

export default class GradientButton extends LightningElement {
  @api label = 'Gradient Button';
  
  handleClick() {
    this.dispatchEvent(new CustomEvent('buttonclick', {
      bubbles: true,
      composed: true
    }));
  }
}
LWC — CSS
.gradient-button {
  padding: 1rem 2rem;
  border-radius: 0.75rem;
  background: linear-gradient(90deg, #a855f7, #ec4899, #06b6d4, #a855f7);
  background-size: 200% 200%;
  color: white;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  animation: gradient-shift 3s ease infinite;
}

.gradient-button:hover {
  box-shadow: 0 20px 40px rgba(168, 85, 247, 0.5);
}

@keyframes gradient-shift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
LWC — Configuration
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
  <apiVersion>59.0</apiVersion>
  <isExposed>true</isExposed>
  <targets>
    <target>lightning__AppPage</target>
    <target>lightning__RecordPage</target>
    <target>lightning__HomePage</target>
  </targets>
</LightningComponentBundle>

Where Animated Gradient Button fits

  • CTA
  • Primary Actions
  • Marketing
  • Landing Pages

Interaction states & animations

  • Gradient Flow
  • Hover
  • Focus

Topics

  • #gradient
  • #animated
  • #colorful
  • #cta
  • #primary
  • #flow

Accessibility notes

Ensure text contrast meets WCAG 2.1 AA standards. Provide visible focus indicator.

Browser support

  • All modern browsers