StealThis .dev

Shimmer Button

A button with a shimmering light sweep effect that glides across periodically, creating an elegant loading or attention animation.

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

Code

Shimmer Button

A button with a periodic shimmering light that sweeps across its surface, creating an eye-catching and polished effect reminiscent of premium UI components.

How it works

  1. A ::before pseudo-element is positioned over the button with a diagonal linear gradient
  2. The gradient has a narrow transparent-white-transparent band
  3. @keyframes shimmer translates this pseudo-element from left to right across the button
  4. The animation repeats on a delay, creating a periodic sweep

Customization

  • Speed: Adjust animation-duration and delay in the keyframes
  • Color: Change the gradient white band to any color for tinted shimmers
  • Angle: Rotate the gradient for different sweep directions

When to use it

  • Premium CTA buttons
  • Loading state indicators on buttons
  • Featured product action buttons