# Glow

> A gradient border with a halo of the same colours glowing behind it, still or turning.

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

## Installation

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

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

The CLI also adds what `glow-frame` is built on: `frame`, `frame-effects`.

Files it adds: `components/ui/frame.tsx`, `components/ui/frame-effects.tsx`, `components/glow-frame.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 { GlowFrame } from "@/components/glow-frame";

<GlowFrame
  colors={["#7e9be9", "#b593dc", "#e4a5a4"]}
  spin
  radius={14}
  className="p-6"
>
  Your content
</GlowFrame>
```

## Examples

### On a shape

Inside a shape frame the halo is the whole shape blurred behind it, so give the shape a fill.

```tsx
import { FrameGlow, FrameGradient } from "@/components/ui/frame-effects";
import { ShapeFrame } from "@/components/ui/shape-frame";

export default function GlowShape() {
  return (
    <ShapeFrame
      corner="bevel"
      corners={["tl", "br"]}
      size={16}
      fill="var(--card)"
      className="w-full max-w-xs p-6 frame-from-indigo-300 frame-to-violet-400"
    >
      <FrameGlow />
      <FrameGradient />
      <p className="font-mono text-sm">Gradient and glow</p>
    </ShapeFrame>
  );
}
```

## Good to know

- GlowFrame is a preset: a Frame with a FrameGlow and a FrameGradient that share their colours. Both layers come from frame-effects.
- The halo is painted behind the frame's content but in front of the frame's own background.

## API reference

### GlowFrame

```tsx
import { GlowFrame } from "@/components/glow-frame";
```

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `colors` | `string[]` | – | Colour stops shared by the border and the halo. |
| `spin` | `boolean \| number` | `false` | Turn the colours around the frame. A number is the seconds one turn takes. |
| `pulse` | `boolean \| number` | `false` | Make the halo breathe. A number is the seconds one breath in takes. |
| `blur` | `number \| string` | `10` | Blur radius of the halo. |
| `spread` | `number \| string` | `14` | Width of the band that is blurred. Wider is brighter. |

Also accepts every Frame prop and every div attribute.

### FrameGlow

```tsx
import { FrameGlow } from "@/components/ui/frame-effects";
```

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `colors` | `string[]` | – | Colour stops, in order. Without them the layer reads the frame-from-*, frame-via-* and frame-to-* utilities. |
| `gradient` | `string` | – | Any CSS image, in place of the gradient built from the colours. |
| `angle` | `number \| string` | `135` | Direction of the gradient. Numbers are degrees. |
| `spin` | `boolean \| number` | `false` | Turn the gradient around the frame. A number is the seconds one turn takes; true is 4. |
| `pulse` | `boolean \| number` | `false` | Breathe in and out. A number is the seconds one breath in takes; true is 2.4. |
| `blur` | `number \| string` | `10` | Blur radius of the halo. |
| `spread` | `number \| string` | `14` | Width of the band that is blurred. Wider is brighter. |
| `opacity` | `number` | `0.75` | Strength of the halo, from 0 to 1. |
| `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.
