Animated Beam Unidirectional
magicui/animated-beam-unidirectionalFreeExample
Example showing a unidirectional animated beam effect.
Live preview
live · rendered by the registry
Rendered by magicui on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://magicui.design/r/animated-beam-unidirectional.jsonSource
1"use client"23import React, { forwardRef, useRef } from "react"45import { cn } from "@/lib/utils"6import { AnimatedBeam } from "@/registry/magicui/animated-beam"78const Circle = forwardRef<9 HTMLDivElement,10 { className?: string; children?: React.ReactNode }11>(({ className, children }, ref) => {12 return (13 <div14 ref={ref}15 className={cn(16 "z-10 flex size-12 items-center justify-center rounded-full border-2 bg-white p-3 shadow-[0_0_20px_-12px_rgba(0,0,0,0.8)]",17 className18 )}19 >20 {children}21 </div>22 )23})2425Circle.displayName = "Circle"2627export default function AnimatedBeamDemo() {28 const containerRef = useRef<HTMLDivElement>(null)29 const div1Ref = useRef<HTMLDivElement>(null)30 const div2Ref = useRef<HTMLDivElement>(null)3132 return (33 <div34 className="relative flex w-full max-w-[500px] items-center justify-center overflow-hidden p-10"35 ref={containerRef}36 >37 <div className="flex size-full flex-col items-stretch justify-between gap-10">38 <div className="flex flex-row justify-between">39 <Circle ref={div1Ref}>40 <Icons.user />41 </Circle>42 <Circle ref={div2Ref}>43 <Icons.openai />44 </Circle>45 </div>46 </div>4748 <AnimatedBeam49 duration={3}50 containerRef={containerRef}51 fromRef={div1Ref}52 toRef={div2Ref}53 />54 </div>55 )56}5758const Icons = {59 openai: () => (60 <svg61 width="24"62 height="24"63 viewBox="0 0 24 24"64 xmlns="http://www.w3.org/2000/svg"65 >66// … truncated
What it pulls in
Other registry items
Files it writes
More from magicui
All 247 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Android Demoandroid-demo | magicui | Examples | Free | no deps | |
| Android Demo 2android-demo-2 | magicui | Examples | Free | no deps | |
| Android Demo 3android-demo-3 | magicui | Examples | Free | no deps | |
| Animated Beam Bidirectionalanimated-beam-bidirectional | magicui | Examples | Free | no deps | |
| Animated Beam Demoanimated-beam-demo | magicui | Examples | Free | 1 dep | |
| Animated Beam Multiple Inputsanimated-beam-multiple-inputs | magicui | Examples | Free | no deps | |
| Animated Beam Multiple Outputsanimated-beam-multiple-outputs | magicui | Examples | Free | no deps | |
| Animated Circular Progress Bar Demoanimated-circular-progress-bar-demo | magicui | Examples | Free | no deps |
