- Location:
sabo/src/components/ui/animated-beam.tsx
The preview shows a simplified version. The actual component dynamically draws an SVG path between two elements within a container using React refs.
When to use
- Draw attention to relationships or flows between elements.
- Use decoratively; avoid covering critical content.
Usage
sabo/src/components/ui/animated-beam.tsx
Key props
RefObject<HTMLElement | null>
Reference to the container element that holds the beam’s coordinate system.
RefObject<HTMLElement | null>
Reference to the starting element where the beam originates.
RefObject<HTMLElement | null>
Reference to the target element where the beam points.
number
default:"0"
Controls the curve of the beam path. Higher values create more pronounced curves.
boolean
default:"false"
Reverses the gradient direction of the beam animation.
number
Animation duration in seconds (randomized by default).
string
default:"gray"
Color of the beam’s path line.
number
default:"2"
Thickness of the beam’s path line in pixels.
string
default:"#ffaa40"
Start color of the animated gradient beam.
string
default:"#9c40ff"
End color of the animated gradient beam.
Styling tip
- Place inside a relatively positioned, rounded container; keep contrast subtle.
- Mark purely decorative instances with
aria-hidden="true".