Skip to documentation content

Border Beam

Send a short segment of light around an element's border to mark it as active or in progress.

border-beam-demo

Overview

Border Beam draws a small light segment that travels around its parent's border. Use it on one element at a time to mark something as live or in progress, such as a running build, a highlighted plan, or the card a tour is pointing at. The beam follows the parent's corner radius, paints only inside the border width, and leaves the content untouched.

Installation

npx honestui@latest add border-beam

Usage

import { BorderBeam } from "@/components/animated/border-beam"

<div className="relative overflow-hidden rounded-xl border p-5">
  Deploying…
  <BorderBeam duration={6} />
</div>

Place it as the last child of a relative element. The radius is read from the parent; pass radius when the parent's radius changes after mount. Two beams with opposite reverse values and half-lap delay give a symmetrical effect.

Accessibility

The beam is decorative and hidden from assistive technology. Pair it with a text status such as "Building" so the state is never conveyed by motion alone. When reduced motion is requested, the beam stops and rests as a short static highlight.

API Reference

PropTypeDefaultDescription
sizenumber72Length of the light segment in px.
durationnumber8Seconds for one lap.
delaynumber0Seconds before the first lap. Negative values start mid-lap.
colorFromstring"var(--foreground)"Color at the head of the beam.
colorTostring–Color the beam fades through toward its tail.
borderWidthnumber1Width of the border the beam travels on, in px.
radiusnumber–Corner radius of the path. Defaults to the parent's border radius.
reversebooleanfalseTravels counterclockwise.
classNamestring–Classes for the border layer.