asafefe.dev

Border Beam

A beam of light that travels around a card border. Great for AI and SaaS surfaces.

utils
Pro planEverything in one place

Installation

$ pnpm dlx shadcn@latest add @soultel/border-beam

No namespace set up? npx shadcn@latest add https://asafefe.dev/r/border-beam.json works too.

Manual installation
  1. 1. Copy the source from the Code tab into components/border-beam.tsx.
  2. 2. Add the keyframes it uses (beam-spin) to your global CSS. The CLI does this for you.

Usage

example.tsx9 lines
import { BorderBeam } from "@/components/border-beam"

export function Example() {
  return (
    <BorderBeam className="w-64">
      <div className="p-6">Your content</div>
    </BorderBeam>
  )
}

Props

PropTypeDefaultDescription
durationnumber5Seconds per lap.
colorFromstring"var(--primary)"Beam tail color.
colorTostring"#f59e0b"Beam head color.
borderRadiusnumber12Corner radius in px.

Notes

The beam is a rotating conic gradient sitting one pixel behind the content, so only the ring shows. It pairs well with pricing cards, AI feature callouts, and anything you want to draw the eye toward.

Props

PropTypeDefault
durationnumber5
colorFromstringvar(--primary)
colorTostring#3b82f6
borderRadiusnumber14
Slow it down with a larger duration, or match your brand by passing colorFrom and colorTo. The inner surface uses bg-card, so it settles into any dark or light theme.