Shine Sweep Button
A shine sweep crosses the button on hover. Pure CSS.
<button class="relative px-6 py-3 rounded-xl bg-slate-900 text-white font-semibold text-sm overflow-hidden group"> <span class="absolute inset-0 -translate-x-full group-hover:translate-x-full transition-transform duration-700 bg-gradient-to-r from-transparent via-white/25 to-transparent"></span> <span class="relative">Hover me</span> </button>
Free to use in personal and commercial projects. No attribution required.
Variants
Same component, different looks. Preview each one live and copy the code you like.
Indigo
Brand color version for primary actions in indigo themed products.
Light
Light surface version for minimal layouts and secondary actions.
Emerald
Green sweep for success actions like checkout or confirm.
About this shine sweep button
The shine sweep is the subtle luxury effect: a diagonal beam of light that crosses the button on hover, like sun glinting off polished metal. It is the button hover effect on premium e-commerce sites and luxury brands where restraint matters more than flash.
This shine button effect uses an absolutely positioned gradient strip (white at 25% opacity) that starts off-screen left (-translate-x-full) and sweeps across on group-hover. The overflow-hidden on the button clips the beam to the button shape. The 700ms duration makes it feel deliberate, not twitchy.
Shine works best on dark buttons where the light beam is visible. On light buttons, use a darker sweep or skip it. One sweep per hover; it should feel like a reward, not a strobe.
Luxury brands face a hover problem: their buttons need to respond to the cursor, but bouncy scales and color flips would shatter the restrained aesthetic. The shine sweep is the answer refined interfaces settled on: a beam of light crossing the button like sun glinting off a watch face. The button's shape, color, and typography never move; only light moves. It rewards the hover without disturbing the calm.
An absolute span carries bg-gradient-to-r from-transparent via-white/25 to-transparent and starts parked off the left edge at -translate-x-full. On group-hover it travels to translate-x-full over transition-transform duration-700. The button's overflow-hidden clips the beam to the rounded shape, and using transition-transform (not transition-all) ensures only the sweep animates while everything else stays rock still.
Tune the beam's character with opacity: via-white/40 for a sharp glint, via-white/10 for a soft wash. Skew the span with -skew-x-12 for a more dramatic diagonal. For pacing, 500ms feels alert and modern while 1000ms feels ceremonial; match it to the brand's tempo the way you would match music.
The mistake is putting the sweep on buttons with photographic or gradient backgrounds. The white beam that glints beautifully on a solid dark button washes out artwork instead, turning a rich background into a pale smear for the duration of the sweep. Reserve the shine for solid-color buttons, and on textured backgrounds either drop the beam's opacity or skip the effect entirely.
Where to use it
- ✓ Luxury brand CTAs
- ✓ Premium e-commerce
- ✓ Dark UI primary buttons
- ✓ Portfolio contact buttons
Customization tips
Adjust the 700ms duration: faster feels energetic, slower feels luxurious. Change the gradient angle by rotating the strip. For a continuous shine, use infinite animation instead of hover trigger.
Design notes
When to use
Use it on dark primary buttons for luxury brands, premium e-commerce, and portfolio contact buttons where restraint matters. The diagonal light sweep on hover feels like sun glinting off metal, a quiet reward for the cursor. One sweep per hover keeps it deliberate.
What to avoid
Do not use it on light buttons where the white beam is invisible, the effect simply vanishes. Do not run the sweep on a continuous loop; an endless shine turns a luxury detail into a distraction.
Accessibility
Respect prefers-reduced-motion by disabling the sweep for users who ask for less animation. The button text must stay readable throughout the sweep, so keep the beam translucent.
Frequently asked questions
How do I make a shine sweep on hover?
Add an absolute gradient strip inside an overflow-hidden button, positioned off-screen with -translate-x-full. On group-hover, translate it to full width with a slow transition.
Why is my shine not visible?
The sweep is white at low opacity, so it only shows on dark backgrounds. On light buttons, use a dark sweep or increase the white opacity.
Can the shine loop automatically?
Yes, replace the hover trigger with an infinite keyframe animation. But hover-triggered feels more premium; auto-loop can feel cheap if overused.
How do I make the shine sweep go the other direction?
The sweep direction comes from the translate direction of the shine layer. If the shine slides from -translate-x-full to translate-x-full, flip both ends and it sweeps right to left instead. A diagonal sweep comes free when the shine element itself is rotated slightly.
Does the shine sweep work with a gradient button background?
Yes, but the shine must be brighter than the background to read. On an already bright gradient, use a white shine with higher opacity. On dark buttons, a white shine at 20 to 30 percent opacity gives the classic glassy sweep.
How do I trigger the shine sweep on page load instead of hover?
Move the sweep from a hover class to a keyframes animation that runs once on load, or add the hover classes with JavaScript when the button scrolls into view. Touch devices have no hover, so a load or scroll trigger is the reliable way to show the effect on mobile.