StealThis .dev

Rainbow Button

A vibrant button with an animated rainbow gradient border that continuously cycles through the color spectrum.

Open in Lab
css javascript vue svelte
Targets: TS JS HTML React Vue Svelte

Code

Rainbow Button

A button featuring an animated rainbow gradient border that smoothly cycles through the entire color spectrum, creating a mesmerizing and attention-grabbing effect.

How it works

  1. A conic-gradient with rainbow hues is applied to a pseudo-element behind the button
  2. The @keyframes rainbow-spin animation rotates the hue-rotate filter continuously
  3. The inner button content sits on a dark background, making the border glow pop

Customization

  • Border width: Adjust the padding on the outer wrapper or the inset on ::before
  • Speed: Change animation-duration for faster or slower color cycling
  • Background: Swap the inner background for a semi-transparent version to let color bleed through

When to use it

  • Premium or special action buttons
  • Creative portfolio CTAs
  • Gaming and entertainment interfaces