Skip to content
synccn

Animated Beam

New

Light travelling along curves between elements.

Installation

$ pnpm dlx shadcn@latest add @synccn/animated-beam

First time in this project? Connect synccn with one command.

Usage

import { AnimatedBeam } from "@/components/ui/animated-beam";<AnimatedBeam containerRef={box} fromRef={a} toRef={b} />

API reference

Generated from the component's TypeScript types, so it always matches the code.

AnimatedBeam

Curved line between two elements with a light travelling along it. Pass refs to a shared relative container and to both ends.

  • containerRefrequired
    React.RefObject<HTMLElement | null>

    Relatively positioned element that holds both ends.

  • fromRefrequired
    React.RefObject<HTMLElement | null>

    Element where the beam starts.

  • toRefrequired
    React.RefObject<HTMLElement | null>

    Element where the beam ends.

  • curvature
    number

    Default 0

    How far the curve bends, in pixels. Negative bends downwards.

  • reverse
    boolean

    Default false

    Run the light from the end back to the start.

  • duration
    number

    Default 3

    Seconds for one pass of the light.

  • delay
    number

    Default 0

    Seconds before the first pass.

  • className
    string

    Extra classes for the root element.

Dependencies

Read from the component's imports when the site builds. The CLI installs all of these for you.

Helpers

npm packages

Accessibility

From the source

Read from this component's code when the site builds, so it can't drift.

No ARIA roles, key handling or motion settings in its source. It renders plain elements, so its accessibility comes from the content and labels you give it.