Gradient Glow
A soft, drifting gradient glow that wraps around your content.
Usage
GradientGlow is a <div> wrapper that paints a blurred, animated gradient behind its children —
the colored "halo" you see around AI features. The gradient slowly rotates a full turn while the glow
gently breathes in and out, so the colors drift around the element for a living, glowing feel. Tune the look with from / via / to (the three
gradient stops), angle (its resting direction), blur (how soft the halo is), and speed (seconds per
rotation).
The glow extends past the element's edges because the layer is blurred — give your children an opaque
surface (e.g. bg-background) so the halo reads as a surrounding shadow rather than washing over the
content. The decorative layers are aria-hidden and pointer-events-none, so they never reach assistive
tech or intercept clicks, and the wrapper forwards className, style, and any native <div> attributes.
Examples
Basic glow
The default aurora gradient — sky blue, lilac, and warm sand — drifting behind a card. By default only
the blurred glow is rendered; the wrapper's radius (rounded-2xl) should match your content's radius so
the halo hugs the corners.
Animated gradient border
Set border to add a 1px stroke that follows the same animated gradient, in sync with the glow. Tune its
thickness with borderWidth. Pair it with a softer, wider blur for a crisp edge over a diffuse halo.
Custom colors
The three stops are fully adjustable via from, via, and to — pass any CSS color. Mix your own
palette to match a brand or mood.
Blur / softness
blur controls how soft the halo is, mapped to Tailwind's blur-* scale (sm through 3xl). Larger
values spread the glow further past the edges for a more diffuse, ambient look.
Reveal on interaction
Set revealOn to keep the glow hidden until an interaction, then fade it in (the animation resumes from
paused). Accepts 'hover' (pointer-only, like Tailwind's hover: variant) and 'press' (works on touch),
or an array to combine them. Since 'hover' can't fire on touch, opt into showOnTouch to keep the glow
persistently visible there instead of hidden. Hover or press a button below.
Controlled (loading state)
For event-driven states — a request in flight, an AI task running — drive the glow with the controlled
reveal boolean instead. It's OR-ed with any revealOn interaction, so you can combine "glow on hover"
with "glow while loading". Click the button to kick off a mock request.
API reference
GradientGlow renders a <div> and forwards every remaining native <div> attribute. The glow and
border layers are aria-hidden and pointer-events-none.
In dark mode the glow and border are automatically dimmed to 60% opacity so they don't look too bright
against dark backgrounds. Tune this via the --gradient-glow-opacity CSS variable, e.g.
className="dark:[--gradient-glow-opacity:0.8]".
Accessibility
- The glow and border layers are
aria-hiddenandpointer-events-none, so they're skipped by assistive tech and never intercept clicks. - Content is wrapped, not replaced — your
childrenstay in the normal flow and fully accessible. - The motion honours
prefers-reduced-motion: the rotation and pulse only run under themotion-safevariant, so reduced-motion users see a static gradient instead of the drift. - The glow is purely decorative — keep your content's own surface and text contrast intact so it stays readable regardless of the colors behind it.