Sunlight Effect
Animated multi-color rays radiating from a bright central glow, with adjustable density, reach, bloom, and motion.
Installation#
pnpm dlx shadcn@latest add @davinciui/sunlight-effectUsage#
API Reference#
| Prop | Type | Default |
|---|---|---|
colorsOne to five colors distributed across the light rays. | string[] | five-color mint palette |
backgroundColorBase color behind the burst. | string | "#020b07" |
bloomColorColor of the atmospheric central glow. | string | "#6dff94" |
bloomStrength and reach of the bloom overlay. | number | 1.12 |
intensityOverall visibility and brightness of the rays. | number | 1.35 |
densityNumber of broad and fine light rays. | number | 1.2 |
spottyShortens and separates rays as it increases. | number | 0.18 |
midSizeRadius of the bright central glow. | number | 0.82 |
midIntensityBrightness of the central glow. | number | 1.72 |
speedAnimation speed. Set to 0 to freeze the field. | number | 1 |
scale / rotation / offsetX / offsetYScale, rotate, and position the burst origin. | number | — |
maxDprMaximum device pixel ratio used by the canvas. | number | 2 |
classNameAdditional classes applied to the full-size layer. | string | — |
Accessibility#
The canvas and fallback are aria-hidden with pointer-events-none, so the effect is excluded from the accessibility tree. It is decorative and provides no focusable elements, labels, or content.
Motion#
Shader time advances by speed while intensity, density, spotty, bloom, and transform props shape the rays. prefers-reduced-motion is checked on mount and on change; the frame loop stops and holds a static frame.
About Sunlight Effect#
Animated rays radiate from a bright central glow, with long mint, lime, and teal shafts fading into deep green shadow.
Build a palette with up to five colors, tune the number and reach of the rays, and add a separate bloom color for atmospheric light. The motion carries light from every edge toward the center while the whole overlay stays anchored behind your content.
The effect uses a small native WebGL shader with no runtime shader library. It fills its parent at every size and redraws when the container changes dimensions.
Controls#
- Colors distributes up to five tones across the ray field.
- Bloom adds a separate soft glow around the center.
- Density and Spottycontrol how many rays appear and how far they extend.
- Mid Size and Intensityshape the luminous center.
- Speed controls the inward light motion. Set it to 0 to hold one frame.
- Scale, Rotation, and Offsetposition the burst behind your composition.
Best For#
Dramatic hero backgrounds, logo reveals, launch pages, energy bursts, and atmospheric light behind large type.
View source
Keep in mind
Need a custom component?
I build bespoke UI components & websites tailored to your brand.

