Border Beam

Animated border highlight that adapts to container size.

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

import { BorderBeam } from "@tilt-legal/cubitt-components/primitives";
<div className="relative overflow-hidden rounded-xl border">
  <BorderBeam lightColor="var(--color-purple-400)" />
</div>

Examples

Custom Colors

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

Duration

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

Border Width

Adjust the beam thickness with the borderWidth prop.

Light Width

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

Layered Beams

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


API Reference

BorderBeam

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

PropTypeDefaultDescription
lightWidthnumber200Width of the light gradient in pixels
durationnumber10Animation duration in seconds for one full loop
lightColorstring"#FAFAFA"CSS color value for the beam
borderWidthnumber1Thickness of the border beam in pixels
cornerRadiusnumber-Border radius for the beam path (clamped to max)
reduceMotionbooleanfalseRenders a deterministic static beam instead of animating
classNamestring-Additional CSS classes

On this page