Components / Effects

Beam

A light that travels the border at a steady speed, around any proportions and any corner.

Deploying to production

step 4 of 6 · 38s

Customize

Length
120px
Lap time
6s
Beams
1
Radius
14px
Reverse

Installation

npx shadcn@latest add https://fancyborders.vercel.app/r/beam-frame.json

The CLI copies the component into your project, adds anything it is built on, and writes its CSS into your global stylesheet. New to the CLI? See Installation.

Examples

On a shape

Inside a shape frame the beam follows the shape's outline.

Around a notched frame

Coloured by utilities

Leave out the colours and the beam reads frame-from-* and frame-to-* from the frame.

frame-from-slate-400

Good to know

  • BeamFrame is a preset: a Frame with a FrameBorder and a FrameBeam. Use the FrameBeam layer directly, from frame-effects, to add a beam to any frame.
  • The beam follows the outline with offset-path, which needs Chromium 116, Firefox 122 or Safari 18. Without it nothing is drawn and the plain border remains.

API reference

BeamFrame

tsx
import { BeamFrame } from "@/components/beam-frame";
PropTypeDefault
colorsstring[]

The beam's colours: the first for its head, the last for its tail.

–
sizenumber | string

Length of the beam.

120
durationnumber | string

Time for one lap of the frame. Numbers are seconds.

6
countnumber

Number of beams, spaced evenly around the frame.

1
reverseboolean

Travel anticlockwise.

false

Also accepts every Frame prop and every div attribute.

FrameBeam

tsx
import { FrameBeam } from "@/components/ui/frame-effects";
PropTypeDefault
colorsstring[]

The beam's colours: the first for its head, the last for its tail. Without them it reads frame-from-* and frame-to-*.

–
sizenumber | string

Length of the beam.

120
durationnumber | string

Time for one lap of the frame. Numbers are seconds.

6
countnumber

Number of beams, spaced evenly around the frame.

1
reverseboolean

Travel anticlockwise.

false
bloomnumber | false

Strength of the light the beam casts on either side of the line. false leaves only the line.

0.25
thicknessnumber | string

Line width, when different from the frame's.

–
offsetnumber | string

Distance from the frame's edge. Positive is outward, negative inward.

0
radiusnumber | string

Overrides the frame's radius for this layer.

–

Also accepts every div attribute, such as className and style.