# Pulse

> A halo that breathes in and out, for something that is live, recording or waiting.

- Category: Effects (Gradient, glow and moving light, as more layers for a frame.)
- Registry item: `frame-effects` — Pulse is a recipe: a few layers of `frame-effects` put together, not an item of its own. Install `frame-effects` and copy the code below.
- Live preview with controls: https://fancyborders.vercel.app/docs/components/pulse

## Installation

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

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

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

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

<Frame radius={999} className="px-5 py-2.5">
  <FrameGlow
    colors={["#d86258", "#e3a072"]}
    pulse
    blur={8}
    spread={10}
  />
  <FrameGradient colors={["#d86258", "#e3a072"]} />
  Recording
</Frame>
```

## Good to know

- The halo holds still for people who ask for reduced motion.

## API reference

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

### FrameGradient

```tsx
import { FrameGradient } 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. |
| `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.
