Skip to content
VenusUI
Get started

Border Beam

A light that travels around the border of a card or container.

Preview

Installation

npx shadcn@latest add @venusui/border-beam

Run this in a project set up with shadcn. If you haven’t set it up yet, run npx shadcn@latest init first.

Files added to your project

Paths use the default shadcn aliases. The CLI follows the aliases in your components.json.

  • @/components/ui/border-beam.tsx

Usage

The code behind the preview above.

border-beam-demo.tsx

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

export default function BorderBeamDemo() {
  return (
    <div className="relative w-full max-w-sm rounded-xl border bg-card p-6">
      <p className="text-sm font-medium text-muted-foreground">Deployment</p>
      <p className="mt-2 text-2xl font-semibold tracking-tight">Building…</p>
      <p className="mt-1 text-sm text-muted-foreground">The light keeps moving while work is in progress.</p>
      <BorderBeam />
    </div>
  )
}

API reference

PropTypeDefaultDescription
durationstring"6s"Time for one trip around the border, as a CSS duration.
colorstring"var(--foreground)"Beam color. Any CSS color.
borderWidthnumber1.5Beam thickness, in pixels.
lengthnumber12Beam length as a percentage of a full turn.

All <div> props, including className and style.

Requirements

  • Tailwind CSS v4. The CLI adds the border-beam keyframes, the --border-beam-angle property and --animate-border-beam to your CSS.
  • A browser with @property support (all current browsers). Older browsers show no beam.

Customization

  • Place <BorderBeam /> as the last child of a relative element. It follows the parent’s border-radius.
  • Use a brand color with color="oklch(0.7 0.15 250)", or two beams with different duration values for a layered effect.

Accessibility

  • Purely decorative: aria-hidden and ignores the pointer.
  • Hidden when the user prefers reduced motion. Don’t rely on it as the only sign that something is loading.

Troubleshooting

The beam fills the whole card instead of the border.
The parent needs position: relative, and your browser must support CSS masks with exclude, which all current browsers do.
The beam doesn’t move.
Check that @property --border-beam-angle and the border-beam keyframes are in your CSS.
Unknown registry "@venusui"
Your shadcn CLI couldn’t find the namespace in the shadcn registry index. Use the latest CLI (npx shadcn@latest), install by URL, or register it with its address: npx shadcn@latest registry add @venusui=https://venusui.com/r/{name}.json.
No components.json found
Run npx shadcn@latest init in your project first.
Loading preview

A tilted wall of vertically scrolling columns, for screenshots and showcases.

Loading preview

A card that tilts in 3D toward the pointer with spring physics.

Loading preview

Background Beams

Backgrounds

Curved lines across a section with light traveling along them.