Border Beam

A beam of dithered light that travels around a card's border.

Border Beam on the recommended pricing plan
Still frame

Installation

pnpm dlx shadcn@latest add @gradients-pro/border-beam

Needs a Pro account and the Pro registry setup.

Usage

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

<BorderBeam className="rounded-2xl border p-6">{children}</BorderBeam>;

The beam follows the element's border radius, so give it rounded-* classes.

Props

PropTypeDefaultDescription
palette"ultramarine" | "ember" | "mono" | string[]"ultramarine"A curated ramp, or your own 2 to 6 CSS colours from faint to hot (var(--x) included). Curated ramps switch between a light and a dark version with your theme.
durationnumber7Seconds for one lap of the border.
lengthnumber0.34Length of the tail as a share of the perimeter, 0.05 to 0.45.
beams1 | 21One beam, or two on opposite sides.
trigger"always" | "hover""always""hover" runs the beam only while hovered or focused within.
cellnumber2Size of one dither cell in CSS pixels.
scheme"light" | "dark"follows the pageForces a colour scheme. By default it reads a dark or light class (or data-theme) on <html>, then the system setting.
className, other div propsThe beam follows this element's border radius, so give it rounded-* classes as usual.