honestui

Animated Beam

Component

About

A curved line between two elements with a pulse of light travelling along it.

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 { Database, Smartphone } from "honestui/icons";
import { useRef } from "react";

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

export default function AnimatedBeamTwoWay() {
  const containerRef = useRef<HTMLDivElement>(null);
  const appRef = useRef<HTMLDivElement>(null);
  const apiRef = useRef<HTMLDivElement>(null);

  return (
    <div ref={containerRef} className="relative flex h-48 w-full max-w-md items-center justify-between px-4">
      <div
        ref={appRef}
        className="z-10 flex w-28 flex-col items-center gap-2 rounded-xl border border-border bg-card p-4 shadow-sm"
      >
        <Smartphone aria-hidden className="size-5 text-foreground" />
        <span className="text-[13px] font-medium text-foreground">Mobile app</span>
      </div>
      <div
        ref={apiRef}
        className="z-10 flex w-28 flex-col items-center gap-2 rounded-xl border border-border bg-card p-4 shadow-sm"
      >
        <Database aria-hidden className="size-5 text-foreground" />
        <span className="text-[13px] font-medium text-foreground">Orders API</span>
      </div>

      <AnimatedBeam
        containerRef={containerRef}
        fromRef={appRef}
        toRef={apiRef}
        curvature={48}
        duration={3}
        gradientStartColor="#3b82f6"
      />
      <AnimatedBeam
        containerRef={containerRef}
        fromRef={appRef}
        toRef={apiRef}
        curvature={-48}
        reverse
        duration={3}
        delay={1.5}
        gradientStartColor="#10b981"
      />
      <span className="absolute top-3 left-1/2 -translate-x-1/2 text-xs text-muted-foreground">Request</span>
      <span className="absolute bottom-3 left-1/2 -translate-x-1/2 text-xs text-muted-foreground">Response</span>
    </div>
  );
}

Dependencies

More by honestui

View all
  • Chromatic Text Reveal

    Chromatic Text Reveal

    31
  • Warp

    Warp

    1
  • Morphing Dialog

    Morphing Dialog

    1
  • Scroll Velocity Text

    Scroll Velocity Text

    1
  • Spotlight

    Spotlight

    1
  • Success Check

    Success Check

    1
  • Typewriter

    Typewriter

    1
  • Schedule Builder

    Schedule Builder