Tailwind Button Hover Effects: 10 Copy-Paste Recipes
October 3, 2026 | 8 min read | Tailwind CSS
By Syed · Frontend Engineer & Creator of UITweak
Buttons are the most clicked elements on any page, and their hover state is the first thing users feel. A flat button with no feedback feels broken, even when it works. Tailwind makes good hover effects almost free: the hover: variant, transition-* utilities, and group-hover: cover nearly every effect below. This guide gives you 10 recipes you can paste straight into your project, plus the accessibility and performance details that separate a polished button from a sloppy one.
Shortcut: design the base button visually in our free Tailwind Button Studio, then add one of the hover recipes below to the exported classes.
The Basics: hover, transition, duration
Every recipe here follows the same three-part pattern. First, a hover: variant changes one or more properties. Second, a transition-* utility tells the browser to animate the change instead of snapping. Third, duration-* and ease-* control the timing. Skip the transition and the hover change will feel instant and cheap; skip the hover change and the transition does nothing. The most common beginner mistake is writing hover:bg-blue-700 with no transition at all.
<!-- the skeleton every recipe uses -->
<button class="... transition-all duration-300 hover:...">
Get started
</button>1. The Lift
The safest hover effect in existence: the button rises slightly and its shadow deepens. It reads as physical, works on every design, and never looks out of place. The active: variant presses it back down, which completes the physical metaphor.
<button class="rounded-xl bg-indigo-600 px-6 py-3 font-semibold text-white
shadow-lg shadow-indigo-600/25
transition-all duration-300
hover:-translate-y-0.5 hover:shadow-xl hover:shadow-indigo-600/30
active:translate-y-0 active:shadow-md">
Get started
</button>2. Simple Color Shift
Sometimes the right answer is the boring one. A slightly darker (or lighter) background on hover is what most design systems use, and users read it instantly. Use transition-colors instead of transition-all so only colors animate and nothing else shifts unexpectedly.
<button class="rounded-xl bg-slate-900 px-6 py-3 font-semibold text-white
transition-colors duration-300 hover:bg-slate-700">
Get started
</button>3. Outline to Fill
An outlined button that fills with color on hover. The trick is a background gradient sized 100% 0% that grows to 100% 100% on hover, so the fill wipes upward. Gradients do not transition directly, but background-size does, which is why this works.
<button class="rounded-xl border-2 border-indigo-600 px-6 py-3 font-semibold text-indigo-600
bg-[linear-gradient(#4f46e5,#4f46e5)] bg-[length:100%_0%] bg-bottom bg-no-repeat
transition-all duration-300
hover:bg-[length:100%_100%] hover:text-white">
Get started
</button>4. Gradient Shift
A gradient that slides on hover. Make the background twice as wide as the button with bg-[length:200%_auto], then move its position to the right on hover. The same gradient-position trick powers most animated gradient buttons you see on landing pages.
<button class="rounded-xl bg-linear-to-r from-indigo-600 via-purple-600 to-indigo-600
bg-[length:200%_auto] px-6 py-3 font-semibold text-white
transition-all duration-500 hover:bg-right">
Get started
</button>Note the bg-linear-to-r syntax: that is Tailwind v4. In v3 the same utility was called bg-gradient-to-r. If your gradient classes silently do nothing, check which version you are on first. Our Tailwind v4 common errors guide covers this rename and the other v4 gotchas.
5. Shine Sweep
A light streak that sweeps across the button on hover. This is the classic "premium" effect on pricing page CTAs. It needs a group wrapper and an absolutely positioned gradient bar that translates from one side to the other. Keep the streak subtle: via-white/30 is plenty.
<button class="group relative overflow-hidden rounded-xl bg-indigo-600
px-6 py-3 font-semibold text-white">
<span class="absolute inset-0 -translate-x-full
bg-linear-to-r from-transparent via-white/30 to-transparent
transition-transform duration-700 group-hover:translate-x-full"></span>
<span class="relative">Get started</span>
</button>6. Arrow Slide
An arrow or icon that nudges forward on hover, hinting that the button leads somewhere. The group-hover: variant lets the parent button's hover state move a child element, which is the cleanest way to animate inner content.
<button class="group rounded-xl bg-slate-900 px-6 py-3 font-semibold text-white
transition-colors duration-300 hover:bg-slate-700">
Get started
<span class="inline-block transition-transform duration-300 group-hover:translate-x-1">
→
</span>
</button>7. Glow Ring
A soft colored glow behind the button on hover. Use an arbitrary shadow-[...] value with a large blur radius and a low-alpha color. Pair it with a slight brightness bump so the button itself feels lit, not just haloed.
<button class="rounded-xl bg-indigo-600 px-6 py-3 font-semibold text-white
transition-all duration-300
hover:shadow-[0_0_30px_rgba(79,70,229,0.6)] hover:brightness-110">
Get started
</button>8. Underline Grow
For text-style buttons and links: an underline that grows from left to right. Animating w-0 to w-full on a child span is the simplest version; it works because width is animatable. For native underlines (trimming overshoot, hover reveals),text-decoration-inset now does this without extra elements, see our trimmed underlines guide.
<button class="group relative px-1 py-2 font-semibold text-indigo-600">
Learn more
<span class="absolute bottom-0 left-0 h-0.5 w-0 bg-indigo-600
transition-all duration-300 group-hover:w-full"></span>
</button>9. Press and Scale
A playful, tactile button: it grows slightly on hover and squashes on press. Keep the scale values small (scale-105, scale-95); anything bigger feels cartoonish. This one pairs well with game UIs and playful brands, less well with banks.
<button class="rounded-xl bg-emerald-600 px-6 py-3 font-semibold text-white
transition-transform duration-150
hover:scale-105 active:scale-95">
Get started
</button>10. Gradient Border Reveal
A dark button wrapped in a 2px gradient border that glows on hover. The structure is a gradient outer button with an inner span carrying the solid background; on hover the inner background goes transparent and the gradient shows through behind the text.
<button class="group rounded-xl bg-linear-to-r from-indigo-500 to-pink-500 p-[2px]
transition-shadow duration-300 hover:shadow-lg hover:shadow-pink-500/40">
<span class="block rounded-[10px] bg-slate-950 px-6 py-3 text-white
transition-colors duration-300 group-hover:bg-transparent">
Get started
</span>
</button>Accessibility: Don't Skip This
Hover effects are decoration; the button must work without them. Four rules cover nearly everything:
- Keyboard users never hover. Mirror every hover style with
focus-visible:so tab navigation shows the same feedback.hover:bg-slate-700 focus-visible:bg-slate-700costs nothing. - Touch devices have no hover. Never hide essential information or actions behind a hover-only reveal. Add
active:states so taps still give feedback. - Respect reduced motion. Wrap decorative sweeps and slides with
motion-safe:, or addmotion-reduce:transition-nonefor users who asked their OS to minimize animation. - Keep contrast on both states. A button that passes contrast at rest but fails on hover (light text on a lightened background) is a real WCAG failure. Check both.
<!-- hover + keyboard + reduced-motion, done right -->
<button class="rounded-xl bg-indigo-600 px-6 py-3 font-semibold text-white
transition-all duration-300 motion-reduce:transition-none
hover:-translate-y-0.5 hover:bg-indigo-500
focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600">
Get started
</button>Performance Notes
Hover animations run on the user's machine, so keep them cheap. Animating transform and opacity is handled by the compositor and stays at 60fps. Animating box-shadow, background-size, or width forces repaints, which is fine for one button but gets janky across a grid of cards. If you need a shadow transition on many elements, put the shadow on a ::before layer and fade its opacity instead. And prefer transition-colors or transition-transform over transition-all so the browser only animates what you intended.
Frequently Asked Questions
Why is my Tailwind hover effect not working?
The usual suspects, in order: another class is overriding the hover style (check specificity and class order), the button is disabled (disabled buttons do not fire hover), or you are using v3 class names in a v4 project (like bg-gradient-to-r instead of bg-linear-to-r). Also confirm the transition utility is present; without it the change happens instantly and looks like nothing happened.
How do I make hover effects work on mobile?
You do not need to. Touch devices have no hover, so design the resting state to stand on its own and add active: variants for tap feedback. Never put content or actions exclusively behind a hover reveal.
Can CSS transition a gradient?
Not directly. Gradients are images, and browsers cannot interpolate between two different gradient definitions. The workarounds in this guide (animating background-size, background-position, or cross-fading two layered gradients with opacity) are the standard solutions.
Is transition-all bad?
It is not bad, but it is imprecise: it animates every animatable property, including ones you did not intend, which can cause subtle jank. Prefer transition-colors, transition-transform, or transition-shadow when you know exactly what changes.
How do I disable hover effects on touch devices?
Tailwind does not ship a touch-only variant, but plain CSS does: @media (hover: hover) matches only devices with a real hover capability. In practice, most teams simply design hover as progressive enhancement and let touch users see the resting state plus active: feedback. The full story, including why taps fake a stuck hover and how to gate it properly, is in our mobile hover fix guide.
Try it now: build your base button in the free Tailwind Button Studio, export the classes, then paste in one of the hover recipes above. For the full button-building walkthrough, see our Tailwind button guide.