Skip to main content

Animated Beam

A beautiful animated beam effect that connects elements with glowing lines.

Installation

bunx shadcn@latest add animated-beam -r uplift

Usage

import { AnimatedBeam } from "@/components/ui/animated-beam";

export default function Example() {
const containerRef = useRef<HTMLDivElement>(null);
const fromRef = useRef<HTMLDivElement>(null);
const toRef = useRef<HTMLDivElement>(null);

return (
<div ref={containerRef} className="relative">
<div ref={fromRef}>From</div>
<div ref={toRef}>To</div>
<AnimatedBeam
containerRef={containerRef}
fromRef={fromRef}
toRef={toRef}
/>
</div>
);
}

Props

PropTypeDescription
containerRefRefObject<HTMLElement>Reference to the container element
fromRefRefObject<HTMLElement>Starting point element
toRefRefObject<HTMLElement>Ending point element
curvaturenumberBeam curve amount
durationnumberAnimation duration in seconds
delaynumberAnimation delay
pathColorstringColor of the beam path
gradientStartColorstringGradient start color
gradientStopColorstringGradient end color