# Lamp Effect

> A 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.

- Kind: Motion component (Motion)
- Docs: https://ui.minidev.pro/docs/lamp-effect
- Source (registry JSON with the full file): https://ui.minidev.pro/r/lamp-effect.json
- License: MIT. One file, yours to edit after install.

## 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.

## Installation

### shadcn CLI (copies the source into your project)

```bash
npx shadcn@latest add @minidev/lamp-effect
```

Writes `components/ui/lamp-effect.tsx` plus the MiniDev files it is built from (button) and installs its npm dependencies. Older CLI versions: `npx shadcn@latest add https://ui.minidev.pro/r/lamp-effect.json`.

### npm package

```bash
npm i minidev-ui-kit lucide-react motion
```

Add the tokens to your global stylesheet once:

```css
@import "tailwindcss";
@import "minidev-ui-kit/styles.css";
@source "../node_modules/minidev-ui-kit";
```

Next.js also needs `transpilePackages: ["minidev-ui-kit"]` in next.config.

## Import

After the shadcn install:

```tsx
import { LampEffect } from "@/components/ui/lamp-effect"
```

From the npm package:

```tsx
import { LampEffect } from "minidev-ui-kit/premium/lamp-effect"
```

## Usage

```tsx
import { LampEffect } from "@/components/ui/lamp-effect"

export function Example() {
  return (
    <LampEffect />
  )
}
```

## Props

| Prop | Type | Default | Required | Description |
| --- | --- | --- | --- | --- |
| `width` | `number` | `440` | no | Width of the lamp line in pixels. The light scales with it and never exceeds the panel. |
| `color` | `string` | `"var(--accent)"` | no | Any CSS colour, including var(--token). Defaults to the accent. |
| `glow` | `number` | `1` | no | Strength of the glow, 0 to 2. |
| `dark` | `boolean` | `true` | no | Keep the panel dark in both themes. Turn off to follow the page theme. |
| `className` | `string` | - | no |  |
| `children` | `React.ReactNode` | - | no | Content lit by the lamp. Defaults to a sample Lumen release headline. |

## Examples

### Custom content

Children replace the sample copy; keep them in the lower half so the light has room to fall on them.

```tsx
<LampEffect>
  <div className="flex h-full flex-col items-center justify-end gap-4 px-6 pb-10 text-center">
    <p className="text-xs font-medium tracking-[0.06em] text-accent-fg uppercase">Northwind annual report</p>
    <p className="max-w-[20ch] text-3xl font-medium tracking-[-0.035em] text-balance text-fg">A year with every invoice accounted for</p>
    <Button variant="outline">Read the report <ArrowRightIcon /></Button>
  </div>
</LampEffect>
```

### 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.

```tsx
<LampEffect color="var(--success)" width={560} glow={1.6} className="h-72" />
```

### Follows the theme

dark false lets the panel take the page theme, so the lamp sits on a light surface in light mode.

```tsx
<LampEffect dark={false} width={320} glow={0.8} className="h-72" />
```

## Accessibility

- All the light layers are `aria-hidden` and `pointer-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.

## FAQ

### 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.

## Rules for generating code

- Use semantic tokens only (bg, surface, sunken, border, fg, fg-muted, fg-subtle, ink, accent, success, warning, danger). Never raw hex or palette steps like blue-500.
- Shadows only from the set: shadow-xs, shadow-sm, shadow-raised, shadow-md, shadow-lg, shadow-overlay.
- Numbers use tabular-nums. Dark mode is the `dark` class on <html>; components never branch on theme.

## Dependencies

- npm: `lucide-react`, `motion`
- Built from: [button](https://ui.minidev.pro/docs/button/md)

## Related

- [Cursor Spotlight Panel](https://ui.minidev.pro/docs/cursor-spotlight-panel/md): A panel whose accent radial spotlight follows the cursor, driven by Framer Motion values without re-renders. It shows a still surface for reduced motion.
- [Retro Grid](https://ui.minidev.pro/docs/retro-grid/md): React retro grid background: a perspective floor receding to a glowing horizon that scrolls slowly toward the viewer, with angle and cell size props.
- [Meteors](https://ui.minidev.pro/docs/meteors/md): React meteors background that sends accent colored streaks with fading tails falling diagonally behind your content, with count, angle and speed props.
- [Animated Feature Row](https://ui.minidev.pro/docs/animated-feature-row/md): A row of feature cards that slide up with a staggered delay when scrolled into view. Pass title and description pairs; reduced motion keeps them still.
- [Card Tilt](https://ui.minidev.pro/docs/card-tilt/md): A card that tilts in 3D toward the pointer on springs, with an accent glare that follows the cursor. It stays flat when reduced motion is preferred.
- [Device Frame Stack](https://ui.minidev.pro/docs/device-frame-stack/md): Three device frames labelled mobile, app and docs that spring into a fanned, rotated stack when scrolled into view. Works as a hero or feature visual.

---

All 557 components: https://ui.minidev.pro/llms.txt (full text: https://ui.minidev.pro/llms-full.txt).
