FadeOverlay
Fades a decorative overlay (a border beam, a shine sweep, …) in and out with
visible, keeping it MOUNTED through its fade-out exit so the overlay's
animation rAF loop survives until the fade completes - then unmounts it.
Honours prefers-reduced-motion by rendering nothing but children (a
static decorative band would read louder than the animation it replaces).
Use as a wrapper (pass children) or a bare overlay (omit them). This is the
shared exit-animation lifecycle that backs BorderBeam and Shine.
Usage
Best practices
Reach for
FadeOverlayto fade a decorative overlay in/out - it keeps the overlay mounted through its fade-out so the animation's rAF loop survives, then unmounts it; don't hand-roll that lifecycle.It's the shared engine behind
BorderBeamandShine- prefer those named components for their specific looks; drop toFadeOverlaydirectly only for a new overlay effect.Needs
ReducedMotionProvider; under reduced motion it renders onlychildren(a static band would read louder than the animation), so the overlay doesn't appear.
Props
Also exports
- interface
FadeOverlayProps
Composition
Used by