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
Installation
npx shadcn@latest add https://fancyborders.vercel.app/r/beam-frame.jsonThe 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
import { BeamFrame } from "@/components/beam-frame";| Prop | Type | Default |
|---|---|---|
| colors | string[]The beam's colours: the first for its head, the last for its tail. | – |
| size | number | stringLength of the beam. | 120 |
| duration | number | stringTime for one lap of the frame. Numbers are seconds. | 6 |
| count | numberNumber of beams, spaced evenly around the frame. | 1 |
| reverse | booleanTravel anticlockwise. | false |
Also accepts every Frame prop and every div attribute.
FrameBeam
import { FrameBeam } from "@/components/ui/frame-effects";| Prop | Type | Default |
|---|---|---|
| colors | string[]The beam's colours: the first for its head, the last for its tail. Without them it reads frame-from-* and frame-to-*. | – |
| size | number | stringLength of the beam. | 120 |
| duration | number | stringTime for one lap of the frame. Numbers are seconds. | 6 |
| count | numberNumber of beams, spaced evenly around the frame. | 1 |
| reverse | booleanTravel anticlockwise. | false |
| bloom | number | falseStrength of the light the beam casts on either side of the line. false leaves only the line. | 0.25 |
| thickness | number | stringLine width, when different from the frame's. | – |
| offset | number | stringDistance from the frame's edge. Positive is outward, negative inward. | 0 |
| radius | number | stringOverrides the frame's radius for this layer. | – |
Also accepts every div attribute, such as className and style.