

<Preview name="BasicBorderBeamExample" />

## Overview [#overview]

`BorderBeam` draws an animated light traveling around a container border. It recalculates the path on resize so the effect stays aligned with the component.

## Usage [#usage]

```tsx
import { BorderBeam } from "@tilt-legal/cubitt-components/primitives";
```

```tsx
<div className="relative overflow-hidden rounded-xl border">
  <BorderBeam lightColor="var(--color-purple-400)" />
</div>
```

## Examples [#examples]

### Custom Colors [#custom-colors]

Use the `lightColor` prop with Tailwind CSS variables to change the beam color.

<Tabs items="['Preview', 'Code']">
  <Tab value="Preview">
    <Preview name="ColorsBorderBeamExample" />
  </Tab>

  <Tab value="Code">
    ```tsx
    import { BorderBeam } from "@tilt-legal/cubitt-components/primitives";

    export default function Component() {
      return (
        <div className="relative overflow-hidden rounded-xl border">
          <BorderBeam lightColor="var(--color-purple-400)" />
        </div>
      );
    }
    ```
  </Tab>
</Tabs>

### Duration [#duration]

Control the animation speed with the `duration` prop (in seconds).

<Tabs items="['Preview', 'Code']">
  <Tab value="Preview">
    <Preview name="DurationBorderBeamExample" />
  </Tab>

  <Tab value="Code">
    ```tsx
    import { BorderBeam } from "@tilt-legal/cubitt-components/primitives";

    export default function Component() {
      return (
        <div className="relative overflow-hidden rounded-xl border">
          <BorderBeam duration={4} lightColor="var(--color-purple-400)" />
        </div>
      );
    }
    ```
  </Tab>
</Tabs>

### Border Width [#border-width]

Adjust the beam thickness with the `borderWidth` prop.

<Tabs items="['Preview', 'Code']">
  <Tab value="Preview">
    <Preview name="BorderWidthBorderBeamExample" />
  </Tab>

  <Tab value="Code">
    ```tsx
    import { BorderBeam } from "@tilt-legal/cubitt-components/primitives";

    export default function Component() {
      return (
        <div className="relative overflow-hidden rounded-xl border">
          <BorderBeam borderWidth={3} lightColor="var(--color-cyan-400)" />
        </div>
      );
    }
    ```
  </Tab>
</Tabs>

### Light Width [#light-width]

Control the trail length with the `lightWidth` prop (in pixels).

<Tabs items="['Preview', 'Code']">
  <Tab value="Preview">
    <Preview name="LightWidthBorderBeamExample" />
  </Tab>

  <Tab value="Code">
    ```tsx
    import { BorderBeam } from "@tilt-legal/cubitt-components/primitives";

    export default function Component() {
      return (
        <div className="relative overflow-hidden rounded-xl border">
          <BorderBeam lightColor="var(--color-purple-400)" lightWidth={400} />
        </div>
      );
    }
    ```
  </Tab>
</Tabs>

### Layered Beams [#layered-beams]

Stack multiple `BorderBeam` components with different colors and speeds for a richer effect.

<Tabs items="['Preview', 'Code']">
  <Tab value="Preview">
    <Preview name="LayeredBorderBeamExample" />
  </Tab>

  <Tab value="Code">
    ```tsx
    import { BorderBeam } from "@tilt-legal/cubitt-components/primitives";

    export default function Component() {
      return (
        <div className="relative overflow-hidden rounded-xl border">
          <BorderBeam
            duration={8}
            lightColor="var(--color-cyan-400)"
            lightWidth={200}
          />
          <BorderBeam
            borderWidth={1.5}
            duration={5}
            lightColor="var(--color-rose-400)"
            lightWidth={120}
          />
        </div>
      );
    }
    ```
  </Tab>
</Tabs>

***

## API Reference [#api-reference]

### BorderBeam [#borderbeam]

The root component. Place it as the **first child** inside a container with `position: relative` and `overflow: hidden`.

| Prop           | Type      | Default     | Description                                              |
| -------------- | --------- | ----------- | -------------------------------------------------------- |
| `lightWidth`   | `number`  | `200`       | Width of the light gradient in pixels                    |
| `duration`     | `number`  | `10`        | Animation duration in seconds for one full loop          |
| `lightColor`   | `string`  | `"#FAFAFA"` | CSS color value for the beam                             |
| `borderWidth`  | `number`  | `1`         | Thickness of the border beam in pixels                   |
| `cornerRadius` | `number`  | -           | Border radius for the beam path (clamped to max)         |
| `reduceMotion` | `boolean` | `false`     | Renders a deterministic static beam instead of animating |
| `className`    | `string`  | -           | Additional CSS classes                                   |
