Border Beam
A beam of light that travels around any element's border.
Build #2841
main · 4f2a91cCompiling 214 modules
Started 38s ago by @mira
Installation
npx shadcn@latest add https://neonkit.heyaadi.com/r/border-beam.jsonUsage
import { BorderBeam } from "@/components/ui/border-beam"
<BorderBeam colorTo="magenta" className="rounded-2xl border border-white/10 p-6">
Anything
</BorderBeam>Examples
Around a button
The beam takes its radius from the wrapper, so round it to match.
Speed, length, direction
API reference
A div wrapper. Give it the same rounding as your content.
| Prop | Type | Default |
|---|---|---|
color | NeonColorHead of the beam. | inherited |
colorTo | NeonColorTail of the beam. | color |
duration | numberSeconds per lap. | 6 |
size | numberBeam length as degrees of a lap: 90 is a quarter of the outline, on any shape. | 90 |
borderWidth | numberThickness in pixels. | 1 |
reverse | booleanRun counter-clockwise. | false |
Accessibility
- The beam is decorative and hidden from assistive tech.
- The beam travels the element's outline with offset-path, so it keeps one speed on long and short edges and bends around corners. Browsers without offset-path rect() get a conic sweep instead.
- With reduced motion the beam holds still, a third of the way round.