Border Beam
MotionReact border beam: a light that travels around any card's border, drawn as a masked conic gradient in your accent colors. Pauses for reduced motion.
Installation
npx shadcn@latest add @minidev/border-beam
MiniDev UI is in the shadcn registry directory, so the short form works with no setup. Older CLI versions can use the full URL: npx shadcn@latest add https://ui.minidev.pro/r/border-beam.json
Usage
import { BorderBeam } from "@/components/ui/border-beam"
export function Example() {
return (
<BorderBeam />
)
}
API reference
When to use
Wrap a card, input or pricing tier with it. The beam is a rotating conic gradient masked to the border ring, so the content inside is untouched; it animates transform only and holds still for reduced motion. Set radius to match the child's corner radius. For light flowing between elements use AnimatedBeam; for a static highlight use a border-accent ring.
Accessibility
- The beam layer is
aria-hiddenandpointer-events-none; inputs and buttons inside keep working. - Only
transform: rotateanimates. Under reduced motion the gradient is drawn but does not move.
Frequently asked questions
Why does the beam not line up with my card's corners?
Set radius to the wrapped element's corner radius in pixels. The default is 18, so a rounded-xl (12px) card needs radius={12}. The child should use rounded-[inherit] or the same radius.
Does BorderBeam change the layout of the wrapped element?
No. It wraps the child in a relative w-fit box and draws the beam in an absolutely positioned ring masked to width pixels, so the child keeps its size. Pass className="w-full" when the child should stretch.
Dependencies
npm
Built from
Examples
Around a card
Wrap your own card; match its radius to the radius prop and the beam hugs the edge.
Around an input
A thin, fast beam draws the eye to one field, for example the invite box on an empty team page.
Slow and long
A longer beam on a slower lap reads as a glow rather than a chase; width thickens the ring.