Border Beam

Stable

An animated rotating border gradient for highlighting elements.

Examples

Basic Usage

Scanning sector...
tsx
<div className="relative flex h-[200px] w-full max-w-[32rem] items-center justify-center rounded-xl bg-slate-950/50">
  <span className="text-sm text-slate-400">Scanning sector...</span>
  <BorderBeam size={200} duration={8} />
</div>

Cyberpunk Variants

Predefined color variants: neon, purple, destructive, green.

Neon
Purple
Destructive
Green (Reverse)
tsx
<div className="grid grid-cols-2 gap-4">
  <div className="relative rounded-lg p-6 bg-slate-900/50"><BorderBeam variant="neon" /></div>
  <div className="relative rounded-lg p-6 bg-slate-900/50"><BorderBeam variant="purple" /></div>
  <div className="relative rounded-lg p-6 bg-slate-900/50"><BorderBeam variant="destructive" /></div>
  <div className="relative rounded-lg p-6 bg-slate-900/50"><BorderBeam variant="green" reverse /></div>
</div>

API Reference

PropertyDescriptionTypeDefault
sizeSize / arc angle of the beam in degrees.number90
durationDuration of the animation in seconds.number6
delayDelay of the animation in seconds.number0
borderWidthWidth of the border beam in pixels.number1.5
variantPredefined color gradient variants."neon" | "purple" | "destructive" | "green"-
reverseReverses the direction of the rotation.booleanfalse
colorFromStarting color of custom gradient.string"#ffffff"
colorToEnding color of custom gradient.string"transparent"