Light Rays
An elegant component that creates animated light rays emanating from the top of a container. Perfect for adding atmospheric lighting effects to hero sections and feature cards.Installation
Usage
Props
The number of light rays to display.
The color of the light rays. Accepts any valid CSS color with transparency recommended.
The blur amount in pixels. Higher values create softer, more diffused rays.
The duration of the animation cycle in seconds. Lower values create faster animations.
The length of each ray. Accepts any valid CSS length value (px, vh, %, etc.).
Additional CSS classes to apply to the container element.
Additional inline styles to apply to the container.
Examples
Basic Light Rays
Blue Light Rays
Purple Ambient Light
Shorter, Faster Rays
Golden Light
Many Rays with Sharp Blur
Notes
- Uses motion-sv for smooth animations
- Each ray has randomized properties (position, rotation, width, swing, delay, duration, intensity)
- Rays animate with opacity changes and gentle swinging motion
- Includes subtle radial gradient backgrounds for ambient glow
- Uses mix-blend-mode: screen for additive light blending
- Rays are positioned absolutely from the top of the container
- Animation creates a continuous loop with slight delays between cycles
- Best used with dark backgrounds for maximum effect
- The component is pointer-events-none to avoid interfering with content