Border beam
A light that travels round the border of a card, a button or an input, to mark the one thing that is new or recommended. It follows whatever corner radius its parent has. For a glow that answers the pointer instead, use the spotlight card.
Install
npx shadcn@latest add @thrum-pro/border-beamThis is a Pro component. The command works once your project has a licence key: set up Pro or see pricing.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
duration | number | Default 6 | Seconds for one lap of the border, at constant speed. |
size | number | Default 140 | The length of the beam, in pixels. Its tail fades to nothing. |
delay | number | Default 0 | Start this many seconds into the lap. Give a second beam half the duration to put it on the opposite side. |
borderWidth | number | Default 2 | The width of the band the beam travels in, in pixels, just inside the parent's edge. |
colorFrom | string | Default "var(--chart-1)" | The colour at the head of the beam, as any CSS colour. A theme variable keeps it right in both themes. |
colorTo | string | Default "var(--chart-2)" | The colour the beam fades through towards its tail. |
reverse | boolean | Default false | Travel anticlockwise. |
paused | boolean | Default false | Freeze the beam where it is. |
className | string | – | Extra classes for the band, merged last. |
...props | ComponentProps<"span"> | – | Every other span attribute is passed through. The beam takes no children. |
Motion and sound
Motion
- The beam travels clockwise round the parent's edge, one lap every 6 seconds by default, at constant speed, and turns with each corner.
- It moves along a CSS motion path: the edge of its own box, which takes the parent's corner radius. The parent and its content never move.
- paused freezes it where it is. delay sets where it starts.
- Reduced motion: no beam at all.
Sound
Silent. This component makes no sound.
Accessibility
- The beam is decoration. It is hidden from screen readers with aria-hidden and takes no pointer events.
- It sits inside the parent's border and never over the content, so it cannot lower the contrast of any text.
- It does not say anything on its own. When it marks a recommended plan, say so in words too, such as a badge reading Recommended.
- The parent needs position: relative. The beam fills it and takes its corner radius with border-radius: inherit.
Source
The source comes with Pro
TypeScript source · Copy-paste ready · MIT-compatible for client projects · Includes all dependencies
Files and dependencies
- Adds
components/ui/border-beam.tsx- Packages
- None
- Brings along
- Nothing
Changelog
- 1.0.0 · 2026-12-03First release.