# BorderBeam

> A single comet of light riding a container's border: a white-hot head, a long feathered tail fading between two colours, a dim hairline that lights up only within the comet's reach, and a soft bloom that sits on the edge.

- Package: `fancy-ui-react` (React 18/19 + Tailwind CSS v4)
- Category: Effects
- Tags: animation, border, gradient, beam, comet, glow
- Types: `BorderBeamProps`
- Docs: https://fancy-ui.rama.app/docs/components/border-beam
- Source: https://github.com/RamaHerbin/fancy-ui/tree/main/react/src/components/border-beam

## Import

```tsx
import { BorderBeam } from 'fancy-ui-react';
```

Setup (once per project): `npm install fancy-ui-react`, then put these lines in your main CSS file (the stylesheet import goes right after `@import "tailwindcss";`):

```css
@import "tailwindcss";
@import "fancy-ui-react/tailwind.css";
```

and import the component styles once in the app entry: `import "fancy-ui-react/styles.css";`. Full guide: https://fancy-ui.rama.app/llms.txt

The names below are the ones to write in React; when one differs from the Svelte name, the Svelte name follows in parentheses. `class` becomes `className`, a callback takes the name the React port declares (`onclick` becomes `onClick`), snippets become `ReactNode` props (render functions when they take arguments) and the default snippet is `children`. Divergences: https://github.com/RamaHerbin/fancy-ui/tree/main/react#divergences-from-the-svelte-api

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `size` | `number` | `200` | Diameter of the pool of light around the comet's head, in pixels |
| `duration` | `number` | `9` | Time for one full lap of the border, in seconds |
| `borderWidth` | `number` | `1.5` | Border width in pixels |
| `anchor` | `number` | `90` | Where the comet starts (and rests with reduced motion), as a percentage of the perimeter clockwise from the top-left (0-100) |
| `colorFrom` | `string` | `"#8ec5ff"` | Colour of the head and the start of the tail |
| `colorTo` | `string` | `"#c084fc"` | Colour the tail fades into |
| `delay` | `number` | `0` | Seconds behind the start position; the comet runs from the first frame |
| `tail` | `number` | `0.25` | Length of the tail as a share of the perimeter (0-1) |
| `glow` | `number` | `0.6` | Strength of the bloom, halo and inner spill of light (0-1) |
| `reverse` | `boolean` | `false` | Travel counter-clockwise instead of clockwise |

## Example

```tsx
import { BorderBeam } from "fancy-ui-react";

export function BorderBeamExample() {
	return (
		<div className="relative mx-auto w-full max-w-md overflow-hidden rounded-2xl border p-6 [--border-beam-radius:16px]">
			<p className="text-sm font-medium">Deploy in progress</p>
			<p className="text-xs opacity-60">edge-eu-west · build 1482</p>
			<BorderBeam />
		</div>
	);
}
```
