Skip to content

Border Beam

Motion

React 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.

src/registry/premium/border-beam.tsx/r/border-beam.json

Installation

bash
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

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

export function Example() {
  return (
    <BorderBeam />
  )
}

API reference

BorderBeam props
PropTypeDefault
childrenReact.ReactNode-
durationSeconds per lap.number6
widthBorder width in pixels.number1.5
lengthBeam length, as a fraction of the lap, 0 to 1.number0.18
radiusCorner radius in pixels; match the wrapped element.number18
classNamestring-

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-hidden and pointer-events-none; inputs and buttons inside keep working.
  • Only transform: rotate animates. 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

motion

Built from

No other MiniDev files

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.

All Animated React components