Light Rays
Volumetric beams with drifting dust.
Lights up at nine
Hall B. Doors open at 21:00, no re-entry after 23:30.
Installation
npx shadcn@latest add https://neonkit.heyaadi.com/r/light-rays.jsonUsage
import { LightRays } from "@/components/ui/light-rays"
<section className="relative overflow-hidden bg-[#05060a]">
<LightRays origin="top" />
<h1 className="relative">Lights up at nine</h1>
</section>Examples
Origins
The source sits just outside the box: top, top-left, top-right, left, right or bottom. The fan always aims at the lower middle of the box.
Empty state
A few narrow beams and extra dust make a quiet 404.
Warm light
Set color for a different kind of light. Amber with little sway reads as late sun through a window.
API reference
Two canvases that fill the nearest positioned parent: soft beams at half resolution, and dust at full resolution. Accepts native div attributes.
| Prop | Type | Default |
|---|---|---|
color | NeonColorBeam and dust color. The source glows whiter than the beams. | inherited |
origin | "top"Where the light comes from. | "top" |
rays | numberNumber of beams. | 7 |
spread | numberWidth of the fan, in degrees. | 64 |
sway | numberHow far each beam swings, in degrees. 0 holds them still. | 4 |
speed | numberSpeed multiplier for the sway and the dust. 0 stops the animation. | 1 |
intensity | numberBrightness of the beams, 0 to 1. | 0.7 |
dust | booleanDust motes. A number scales how many (2 is twice as many). | true |
Accessibility
- Decorative: rendered with aria-hidden and pointer-events: none.
- Beams render at half resolution, which costs a quarter of the pixels; they're soft, so the browser's upscale does the blurring for free.
- It pauses offscreen and in hidden tabs, and draws one still frame under prefers-reduced-motion.