Join our Discord community
Special effects

Animated Beam

Animated beam connection component for React and Next.js applications. Built with TypeScript support, Tailwind CSS styling, and shadcn/ui design featuring SVG path animations, bidirectional flow, and customizable gradients.

Powered by

Loading component...

Installation

npx shadcn@latest add https://www.shadcn.io/registry/animated-beam.json
npx shadcn@latest add https://www.shadcn.io/registry/animated-beam.json
pnpm dlx shadcn@latest add https://www.shadcn.io/registry/animated-beam.json
bunx shadcn@latest add https://www.shadcn.io/registry/animated-beam.json

Features

  • SVG path animations - Smooth curved and straight beam connections using Motion library
  • Bidirectional flow - Reverse animation support for complex data visualizations using JavaScript
  • Automatic positioning - Dynamic path calculation between elements using React refs
  • Customizable gradients - Color, timing, curvature, and offset controls using TypeScript props
  • Responsive design - ResizeObserver integration for container updates in Next.js applications
  • Performance optimized - GPU-accelerated transforms with efficient rendering using Tailwind CSS
  • Accessibility features - ARIA attributes and reduced motion support using shadcn/ui patterns
  • Open source - Free component with comprehensive API and documentation

Examples

Bidirectional Beam

Loading component...

Multiple Outputs

Loading component...

API Reference

AnimatedBeam

PropTypeDefaultDescription
classNamestringundefinedAdditional CSS class names to apply to the beam component
containerRefRefObject<HTMLElement>requiredRef to the container element that wraps the beam and its connected elements
fromRefRefObject<HTMLElement>requiredRef to the source element where the beam animation starts
toRefRefObject<HTMLElement>requiredRef to the target element where the beam animation ends
curvaturenumber0Controls the curve of the beam path. Positive values curve upward, negative values curve downward
reversebooleanfalseReverses the animation direction, making the beam flow from target to source
durationnumberMath.random() * 3 + 4Animation duration in seconds. Random by default for organic feel
delaynumber0Delay before animation starts in seconds
pathColorstring"gray"Color of the static beam path background
pathWidthnumber2Width of the beam path in pixels
pathOpacitynumber0.2Opacity of the static beam path (0-1)
gradientStartColorstring"#ffaa40"Starting color of the animated gradient beam
gradientStopColorstring"#9c40ff"Ending color of the animated gradient beam
startXOffsetnumber0Horizontal offset from the source element center in pixels
startYOffsetnumber0Vertical offset from the source element center in pixels
endXOffsetnumber0Horizontal offset from the target element center in pixels
endYOffsetnumber0Vertical offset from the target element center in pixels

Use Cases

  • Data flow diagrams - Visualize data movement between services and components
  • Process workflows - Illustrate step-by-step operations with animated connections
  • Dashboard connections - Link widgets and metrics with visual relationships
  • System architecture - Show communication paths in technical diagrams

Implementation

Built with Motion for smooth SVG animations. Uses React refs for automatic positioning. Supports custom gradients and bidirectional flow. ResizeObserver handles responsive updates.