# Spotlight

> Borders that light up near the pointer, across every frame on the page at once.

- Category: Effects (Gradient, glow and moving light, as more layers for a frame.)
- Registry item: `frame-spotlight`
- Live preview with controls: https://fancyborders.vercel.app/docs/components/spotlight

## Installation

```bash
npx shadcn@latest add https://fancyborders.vercel.app/r/frame-spotlight.json
```

With the registry namespace: `npx shadcn@latest add @fancyborders/frame-spotlight`.

The CLI also adds what `frame-spotlight` is built on: `frame`.

Files it adds: `components/ui/frame.tsx`, `components/ui/frame-spotlight.tsx`, and its CSS goes into the global stylesheet after the Tailwind import.

## Usage

The code for the preview at its default settings:

```tsx
import { Frame, FrameBorder } from "@/components/ui/frame";
import { FrameSpotlight } from "@/components/ui/frame-spotlight";

<Frame radius={10} className="p-4">
  <FrameBorder />
  <FrameSpotlight size={140} wash />
  Your content
</Frame>
```

## Good to know

- Every spotlight on the page shares one pointer listener, and updates at most once a frame.
- This is a client component. Put it over a faint FrameBorder so the frame keeps an edge where the light does not reach.

## API reference

### FrameSpotlight

```tsx
import { FrameSpotlight } from "@/components/ui/frame-spotlight";
```

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `colors` | `string[]` | `the text colour` | Colour of the light, or two colours for its centre and its edge. |
| `size` | `number \| string` | `220` | Radius of the light. |
| `wash` | `boolean \| number` | `false` | Also wash the frame's surface with the light. A number is the wash's strength; true is 0.08. |
| `thickness` | `number \| string` | – | Line width, when different from the frame's. |
| `offset` | `number \| string` | `0` | Distance from the frame's edge. Positive is outward, negative inward. |
| `radius` | `number \| string` | – | Overrides the frame's radius for this layer. |

Also accepts every div attribute, such as className and style.
