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
import { FadeOverlay, FadeOverlayProps } from "@desk/ui/components/fade-overlay";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 expect the overlay to simply not appear.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| visible | boolean | Drives the fade in/out of the overlay. | |
| radius | string | number | Border radius of the fade container. | |
| overlay | ReactNode | The decorative overlay content (border beam, shine sweep, …). | |
| className | string | undefined | Positional overrides forwarded to the fade container. | |
| children | ReactNode | Optional wrapped content. When provided, the overlay wraps it in a
|
Also exports
- interface
FadeOverlayProps
Composition
Used by