Lamp Effect
MotionA React lamp effect for dark hero panels: a thin bright line at the top switches on and widens, casting a soft cone of light on the headline beneath it.
Installation
npx shadcn@latest add @minidev/lamp-effect
MiniDev UI is in the shadcn registry directory, so the short form works with no setup. Older CLI versions can use the full URL: npx shadcn@latest add https://ui.minidev.pro/r/lamp-effect.json
Usage
import { LampEffect } from "@/components/ui/lamp-effect"
export function Example() {
return (
<LampEffect />
)
}
API reference
| Prop | Type | Default |
|---|---|---|
| widthWidth of the lamp line in pixels. The light scales with it and never exceeds the panel. | number | 440 |
| colorAny CSS colour, including var(--token). Defaults to the accent. | string | "var(--accent)" |
| glowStrength of the glow, 0 to 2. | number | 1 |
| darkKeep the panel dark in both themes. Turn off to follow the page theme. | boolean | true |
| className | string | - |
| childrenContent lit by the lamp. Defaults to a sample Lumen release headline. | React.ReactNode | - |
When to use
Use it for one launch or release headline that should feel lit from above. Reach for CursorSpotlightPanel when the light should follow the pointer, and RetroGrid or Meteors when the backdrop itself should move.
Accessibility
- All the light layers are
aria-hiddenandpointer-events-none. - The switch-on plays once, when 30% of the panel is in view. Under reduced motion the lamp is already on.
- Because the panel forces the dark tokens, your content inside should use tokens (
text-fg) rather than fixed colours so it stays readable.
Frequently asked questions
Why is the lamp panel dark in light mode?
dark defaults to true and adds the dark class to the panel, so the tokens inside switch to their dark values and the light has something to fall on. Pass dark={false} to follow the page theme.
Where should my headline sit?
The lamp line is fixed at 34% of the panel height, and the default content is pushed to the bottom with justify-end. Keep your children in the lower two thirds so the light falls on them. width (default 440px) sets the line length and never exceeds 84% of the panel.
Dependencies
npm
Built from
Examples
Custom content
Children replace the sample copy; keep them in the lower half so the light has room to fall on them.
Colour, width and glow
color takes any CSS colour, tokens included; width is the lamp line in pixels and glow scales the spill from 0 to 2.
Follows the theme
dark false lets the panel take the page theme, so the lamp sits on a light surface in light mode.