Introducing Magic UI Pro - 50+ blocks and templates to build beautiful landing pages in minutes.

Docs
Border Beam

Border Beam

An animated beam of light which travels along the border of its container.

Login

Enter your credentials to access your account.

Installation

Examples

2 Border Beams

Now Playing

Stairway to Heaven - Led Zeppelin

2:458:02

Reverse

Login

Enter your credentials to access your account.

Spring Animation

Usage

Just place the border beam component inside a div with relative positioning, and overflow-hidden. You will notice the beam automatically moves around the perimeter of it's container.

import { BorderBeam } from "@/components/magicui/border-beam.tsx";
 
export default async function App() {
  return (
    <div className="relative overflow-hidden">
      <BorderBeam />
    </div>
  );
}

Props

Border Beam

PropTypeDefaultDescription
classNamestring-Custom class to apply to the component
sizenumber50Size of the beam
durationnumber6Duration of the animation in seconds
delaynumber0Delay before the animation starts
colorFromstring#ffaa40Start color of the beam gradient
colorTostring#9c40ffEnd color of the beam gradient
transitionTransition-Custom motion transition configuration
styleReact.CSSProperties-Custom CSS styles to apply
reversebooleanfalseWhether to reverse animation direction
initialOffsetnumber0Initial offset position (0-100)