vamsiy78

Animated Beam

Component

About

An SVG beam that connects two elements with a curved, animated gradient pulse — used to visualize integrations, data flow, or sync between nodes in a diagram.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Animated Beam to your project and fits it to your theme.

Code

How Animated Beam is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

"use client";

import * as React from "react";
import * as Icons from "lucide-react";

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

export default function AnimatedBeamBidirectional() {
  const containerRef = React.useRef<HTMLDivElement>(null);
  const laptopRef = React.useRef<HTMLDivElement>(null);
  const cloudRef = React.useRef<HTMLDivElement>(null);

  return (
    <div
      ref={containerRef}
      className="relative flex w-full max-w-md items-center justify-between px-4 py-10"
    >
      <div className="relative z-10 flex flex-col items-center gap-2">
        <div
          ref={laptopRef}
          className="flex size-14 items-center justify-center rounded-2xl border bg-card shadow-sm"
        >
          <Icons.Laptop className="size-6" aria-hidden="true" />
        </div>
        <span className="text-xs text-muted-foreground">This Mac</span>
      </div>
      <div className="relative z-10 flex flex-col items-center gap-2">
        <div
          ref={cloudRef}
          className="flex size-14 items-center justify-center rounded-2xl border bg-card shadow-sm"
        >
          <Icons.Cloud className="size-6" aria-hidden="true" />
        </div>
        <span className="text-xs text-muted-foreground">Cloud</span>
      </div>
      <AnimatedBeam
        containerRef={containerRef}
        fromRef={laptopRef}
        toRef={cloudRef}
        curvature={36}
      />
      <AnimatedBeam
        containerRef={containerRef}
        fromRef={laptopRef}
        toRef={cloudRef}
        curvature={-36}
        reverse
        delay={1.6}
        gradientStartColor="var(--chart-2)"
        gradientStopColor="var(--chart-1)"
      />
    </div>
  );
}

Dependencies

More by vamsiy78

View all
  • Segmented Control

    Segmented Control

    8
  • Agent Roster

    Agent Roster

    5
  • Table Of Contents

    Table Of Contents

    1
  • API Key Field

    API Key Field

    1
  • Toast Stack

    Toast Stack

  • Team Portrait Grid

    Team Portrait Grid

  • Image Cropper

    Image Cropper

  • Search Field

    Search Field