Rendyn

Component library

109 components

Interaction

Animated Beam

Animated Beam draws an SVG path between the centres of two referenced elements. Use it to illustrate a relationship between systems while explaining that relationship in ordinary text.

Interactive exampleReact Tailwind CSS

Practical React example

Illustrate an app sending content to a search index. The labels and caption carry the meaning; the moving gradient is decorative and does not represent a live connection or measured data flow.

Before you copy and paste

Copy AnimatedBeam and its cn utility, install Motion and use a client component. The outer diagram must be relatively positioned and have a measurable width and height. Attach refs to real DOM elements rather than components that do not forward them.

Listed package dependencies: motion.

Use the Code tab for the component files and installation instructions, then adapt the imports in this example to your project.

Connect two labelled nodes inside a measured container

'use client';

import { useRef } from 'react';
import { AnimatedBeam } from '@/components/magicui/animated-beam';

export function IntegrationConnection() {
  const container = useRef<HTMLDivElement>(null);
  const source = useRef<HTMLSpanElement>(null);
  const destination = useRef<HTMLSpanElement>(null);

  return (
    <figure className="m-0">
      <div ref={container} className="relative flex h-40 items-center justify-between gap-16 p-8">
        <span ref={source} className="relative z-10 rounded-xl border bg-background p-3">Your app</span>
        <span ref={destination} className="relative z-10 rounded-xl border bg-background p-3">Search index</span>
        <div aria-hidden="true" className="motion-reduce:hidden">
          <AnimatedBeam
            containerRef={container}
            fromRef={source}
            toRef={destination}
            duration={6}
            pathColor="#94a3b8"
            gradientStartColor="#2563eb"
            gradientStopColor="#38bdf8"
          />
        </div>
      </div>
      <figcaption>Your app sends searchable content to the search index.</figcaption>
    </figure>
  );
}

containerRef defines the coordinate system. fromRef and toRef identify the endpoints. The SVG is absolutely positioned relative to the outer container, and the labels sit above it. The motion-reduce class hides the decorative beam while leaving both labels and the relationship caption visible.

Customization

containerRef / fromRef / toRef
All three refs must resolve to mounted HTML elements. A missing ref or zero-size container leaves no useful path to draw. This version observes container resize, not every endpoint layout change.
curvature / offsets
curvature moves the quadratic control point vertically. startXOffset, startYOffset, endXOffset and endYOffset shift endpoint centres in pixels; recheck small screens after changing them.
duration / repeat / path styling
duration is seconds per gradient pass; repeat defaults to Infinity. pathColor and pathOpacity style the base path, while gradientStartColor and gradientStopColor style the moving overlay.

Integration notes

  • This is a visual diagram, not a network client. Keep the actual relationship in text, and do not label a decorative animation as live traffic.
  • The imported source has no built-in reduced-motion handling. The example hides it with CSS; that does not unmount its animation. Adapt the source or conditionally mount it if avoiding animation work is also required.
  • If the beam is missing, inspect all three refs, container dimensions and relative positioning. If endpoints move without the container resizing, this source may need an additional layout update mechanism.

Component source: Magic UI documentation . These examples describe the version imported into Rendyn. Upstream APIs may have changed; retain the source licence notices when adapting the code.

Better with your agent

Give your agent taste.

The best way to use Rendyn is through MCP. Let your agent find the right component, compare previews and bring the source into your project.

All components are free. Sign up only to connect MCP.

Connect to MCP