Hulian UIv0.93.5413 components0 components
  • Start
  • Components
  • Blocks
  • Pages
  • Demos
  • Changelog
ChineseEnglish
  • ComponentsComponents
  • ThemeTheme

Backgrounds

  • DotPattern
  • GridPattern
  • StripedPattern
  • Spotlight
  • FadeMask
  • RetroGrid
  • Ripple
  • Meteors
  • Aurora
  • Particles
  • FlickeringGrid
  • WavyBackground
  • Silk
  • Iridescence
  • Threads
  • Orb
  • LiquidChrome
  • Balatro
  • Ballpit
  • Beams
  • ColorBends
  • DarkVeil
  • Dither
  • DotField
  • EvilEye
  • FaultyTerminal
  • Ferrofluid
  • FloatingLines
  • Galaxy
  • GradientBlinds
  • Grainient
  • GridDistortion
  • GridMotion
  • GridScan
  • Hyperspeed
  • LetterGlitch
  • Lightfall
  • Lightning
  • LightPillar
  • LightRays
  • LineWaves
  • LiquidEther
  • PixelBlast
  • PixelSnow
  • Plasma
  • PlasmaWave
  • Prism
  • PrismaticBurst
  • Radar
  • RippleGrid
  • ShapeGrid
  • SideRays
  • SoftAurora

Overlay Effects

  • BorderBeam
  • ShineBorder
  • GlareHover
  • Lens
  • AnimatedBeam
  • OrbitingCircles
  • ProgressiveBlur
  • CardSpotlight
  • Reveal
  • Antigravity
  • BlobCursor
  • ClickSpark
  • Crosshair
  • ElectricBorder
  • GhostCursor
  • GradualBlur
  • ImageTrail
  • LaserFlow
  • MagicRings
  • Magnet
  • MagnetLines
  • MetaBalls
  • MetallicPaint
  • OrbitImages
  • PixelTrail
  • PixelTransition
  • Ribbons
  • ShapeBlur
  • SplashCursor
  • StarBorder
  • StickerPeel
  • TargetCursor
  • Cubes
  • Tilt
  • BorderGlow
  • GlassIcons
  • GlassSurface
  • Lanyard
  • ModelViewer
  • FluidGlass

AnimatedBeam

animated-beam

Draws animated directional beams between referenced elements.

Usage

Flow left to right

Connect two sets of nodes in the container, and the beam sweeps from left to right along the curve (reverse=false).

tsx
<div ref={container} className="relative flex items-center justify-between">
  <div ref={l1}>...</div>
  <div ref={hub}>...</div>
  <AnimatedBeam containerRef={container} fromRef={l1} toRef={hub} curvature={30} reverse={false} />
</div>

Gathering around

The light beam flows into the center on the left side and in the opposite direction on the right side, creating the impression that data is gathered into the center.

tsx
{/* The left two lines reverse=false flow into the center, the right two lines reverse=true flow into the center */}
<AnimatedBeam containerRef={container} fromRef={l1} toRef={hub} curvature={30} reverse={false} />
<AnimatedBeam containerRef={container} fromRef={hub} toRef={r1} curvature={-30} reverse={true} />

Right to left flow

The overall reverse direction, the beam sweeps from right to left, expressing the reflow/response direction.

tsx
<AnimatedBeam containerRef={container} fromRef={l1} toRef={hub} curvature={30} reverse={true} />

When to Use

Use it when you want to connect two DOM nodes in the canvas with a flowing curve (architecture diagram, integration diagram, AI data flow, "convergence to hub" animation). It relies on containerRef/fromRef/toRef to measure the endpoint geometry and draw SVG curves, which can be stacked to form a network. To orbit the light point of a single container border, use BorderBeam; to rotate the icon along a circle, use OrbitingCircles.

Import

ts
import { AnimatedBeam } from "@hulianui/ui"

Props

NameTypeDefaultDescription
containerRef*RefObject<HTMLElement | null>-Positioning reference container, must be position:relative
fromRef*RefObject<HTMLElement | null>-starting element ref
toRef*RefObject<HTMLElement | null>-end element ref
curvaturenumber0Curvature (>0 convex)
reversebooleanfalseBeam reverse flow
durationnumber4Duration of one pass in seconds
delaynumber0Start delay in seconds
pathColorstringvar(--color-border)Base path color
pathWidthnumber2Base path width
pathOpacitynumber0.2Base path opacity
gradientStartColorstringvar(--color-chart-1)Beam-gradient start color
gradientStopColorstringvar(--color-chart-2)Beam-gradient end color
startXOffset / startYOffsetnumber0Start-point offset
endXOffset / endYOffsetnumber0End-point offset
classNamestring-Class name forwarded to the SVG

Usage Guidelines

  • This client component measures refs, so its consumer must use "use client". The containerRef element must use position: relative, or the path coordinates will be misaligned.
  • reverse controls the horizontal scan direction independently of endpoint order: false moves left to right and true moves right to left. For beams converging on a center node, reverse the beam on the right.
  • Token-valued color props need the --color- prefix; see [[hulian-token-color-var-needs-color-prefix]].
  • Endpoints and the beam share a container. Give endpoints a layer such as z-10 so they render above the beam.
  • When the system prefers reduced motion, the travelling light and its gradient are skipped and only the static connector line remains. That line carries the "A connects to B" information, so it is not dropped along with the animation.

Related

BorderBeam · ShineBorder · GlareHover · Lens · OrbitingCircles · ProgressiveBlur

PreviousLensDecorationNextOrbitingCircles

On this page

  • Usage
  • Documentation
    • When to Use
    • Import
    • Props
    • Usage Guidelines
    • Related