---
title: "Border Beam"
description: "Light on the edge of a card, field, or button while work runs: a lap, a line, a pulse, a color flow, a voice level, or a rim. No light at rest."
url: https://gelatinui.com/components/border-beam
markdown_url: https://gelatinui.com/components/border-beam.md
access: free
install: "npx shadcn@latest add @gelatin-ui/border-beam"
registry_item: https://gelatinui.com/r/border-beam.json
version: "2026-11-09"
index: https://gelatinui.com/llms.txt
docs_index: https://gelatinui.com/docs/llms.txt
---

# Border Beam

> Light on the edge of a card, field, or button while work runs: a lap, a line, a pulse, a color flow, a voice level, or a rim. No light at rest.

Page: https://gelatinui.com/components/border-beam

## When to use it

Best for: Show that work runs on one surface, such as an AI summary, and end with a done or error rim.

- Wrap one child and set `active` while the work runs. The light goes out when it turns false.
- Set `outcome` to `done` or `error` when the work ends, and back to `undefined` when the next run starts.
- Use `type="level"` with a Motion value in `level` for a voice input, and `type="flow"` for a whole panel.
- Use `placement="outside"` on a `flow` card or dialog, so the surface stays clean.

## When not to use it

- For work with a known percent, use a [Progress](https://gelatinui.com/components/progress.md).
- For a part of the page that loads, use a [Skeleton](https://gelatinui.com/components/skeleton.md).
- For a small wait inside a button, use a [Spinner](https://gelatinui.com/components/spinner.md).

## Notes for agents

- It draws nothing while `active` is false and no outcome shows, so a resting item has no extra layers.
- `colors` takes 1 to 7 CSS colors. The default is `var(--primary)`.
- The light follows the corner radius of the child. Set `radius` when the child has none.
- The light adds no role and no focus stop. Say the state in the child text, such as "Summarizing".
- Every loop stops off screen and in a hidden tab.

## Anatomy

```text
BorderBeam
```

## API reference

### BorderBeam

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `children` | `ReactNode` |  |  |
| `type` | `BorderBeamType` | "beam" | The look of the light. `beam` (default): a band laps the edge. `line`: light on one side that breathes. `pulse`: the whole edge breathes. `flow`: the whole edge lit, colors drift apart. `level`: the whole edge follows `level`. `rim`: the full edge, a breath, and a pointer spot. |
| `colors` | `readonly string[]` | DEFAULT_COLORS | One to seven CSS colors of the light, in order along the light. Default: the `primary` token. `AURORA_COLORS` (the aurora colors, also for `flow`) lives in `#/lib/aurora-colors`. |
| `active` | `boolean` | false | The work runs: the light comes in, and goes out when it turns false. Default false. |
| `outcome` | `BorderBeamOutcome` |  | The result of the work. A change to `done` draws a `success` rim that closes its loop; a change to `error` shows a `destructive` rim. In 150ms, a hold of 600ms, out in 600ms. A value set at mount shows no rim. Set it back to `undefined` when the next run starts. |
| `level` | `MotionValue<number>` |  | The audio level, 0 to 1, of the `level` type, or of a `flow` that swells with a voice (a Motion value, so React does not render per frame). The edge smooths it (`smoothLevel`), so it swells and never flickers. Without it the edge is fully lit. |
| `duration` | `number` |  | Seconds of one cycle. Default per type: beam 4.5, line 2.4, pulse 2.4, flow 7, rim 4. |
| `length` | `number` | 0.25 | The share of the edge that the `beam` lights, 0.04 to 0.5. Default 0.25. |
| `count` | `1 \| 2` | 1 | How many beams lap the edge, on one clock. Default 1. |
| `palette` | `"carried" \| "painted"` | "carried" | `carried` (default): every color rides inside the beam. `painted`: the colors stay in place around the edge, and the beam shows the color under it, so it changes hue as it travels. |
| `side` | `"bottom" \| "top"` | "bottom" | The side that the `line` lights. Default `bottom`. |
| `origin` | `"bottom" \| "pointer" \| "side"` | "bottom" | Where the `flow` light opens: `bottom` (default), `side` (the inline end), or `pointer`. |
| `placement` | `"inside" \| "outside"` | "inside" | Where the `flow` light falls. `inside` (default): it spills inward, for panels and page edges. `outside`: a halo, and the surface stays clean, for cards and dialogs. |
| `strength` | `number` | 1 | The strength of the light layers, 0 to 1 (never the outcome rim). Default 1. |
| `bloom` | `boolean` | true | The soft bloom around the child. Default true. |
| `innerLight` | `boolean` | true | The light that falls on the surface inside the edge (`beam`, `line`, inside `flow`). Default true. |
| `radius` | `string \| number` |  | The corner radius of the light, in px or any CSS length. Default: the radius of the child, read when its size changes. |
| `onSettle` | `function` |  | Called when the light comes to rest: `running` after it came in, `off` after it went out. |

## Styling

| Part | Slot | States | CSS variables | Tokens |
| --- | --- | --- | --- | --- |
| BorderBeam | `border-beam` |  | `--border-beam-bloom-level`, `--border-beam-core`, `--border-beam-falloff`, `--border-beam-mid`, `--border-beam-origin`, `--border-beam-outcome`, `--border-beam-presence`, `--border-beam-radius`, `--border-beam-reach`, `--border-beam-ring-level`, `--border-beam-spot`, `--border-beam-spot-x`, `--border-beam-spot-y`, `--border-beam-strength`, `--border-beam-sweep` |  |

## Usage

Wrap one child. Set `active` while the work runs, then set `outcome`.

```tsx title="summary-card.tsx"
import { BorderBeam } from "@/components/effects/border-beam";

export function SummaryCard({
  running,
  failed,
}: Readonly<{ running: boolean; failed: boolean }>) {
  return (
    <BorderBeam active={running} outcome={running ? undefined : failed ? "error" : "done"}>
      <div className="rounded-xl border bg-card p-4 text-sm">
        {running ? "Summarizing 14 comments" : "Summary ready"}
      </div>
    </BorderBeam>
  );
}
```

## Compose

Rules:

- Compose the parts (`compose-parts`): Build each item from its named parts as children, and pass your text and icons in as parts.
- Every state is designed (`every-state`): Give each view of data its loading, empty, and error states: a skeleton in the final layout, an `Empty` with an illustration and one next action, and an error that says what failed and how to retry.

## Add it

```bash
npx shadcn@latest add @gelatin-ui/border-beam
```

It adds 28 registry items: 26 files, 4812 lines, and the npm packages `@base-ui/react`, `@mantine/hooks`, `@xstate/react`, `clsx`, `motion`, `tailwind-merge`, `tailwind-variants`, `xstate`.

## For AI agents

- Every item, one file: https://gelatinui.com/llms.txt
- MCP server (`search_items`, `get_item`, `get_install_plan`): https://gelatinui.com/mcp

## Related

- [Spinner](https://gelatinui.com/components/spinner.md)
- [Progress](https://gelatinui.com/components/progress.md)
- [Skeleton](https://gelatinui.com/components/skeleton.md)
- [Card](https://gelatinui.com/components/card.md)

## Accessibility

Every light layer is `aria-hidden` and ignores the pointer. The child keeps its own role, focus, and clicks.

The light adds no text. Put the state of the work in the child, so every reader gets it.

The outcome rim fades in over 150ms, so a quick change of outcome never flashes more than three times a second.

## Motion

| Part | Motion |
| --- | --- |
| Light in and out | theme · 450ms · ease-panel (0.2, 0.4, 0.2, 1) |
| Beam lap | progress · one lap in `duration` seconds (4.5 by default), at one speed |
| Line and pulse breath | sine · one breath in `duration` seconds (2.4 by default) |
| Flow opens | chart · 600ms · the light opens from its origin around both sides |
| Outcome rim | fade · 150ms in, a 600ms hold, then 600ms out (chart) |
