border-beam
componentry/border-beamFreeComponent
A moving gradient beam that travels along the border of its container.
Live preview
live · rendered by the registry
Rendered by componentry on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://componentry.dev/r/border-beam.jsonSource
1"use client"23import { motion } from "framer-motion"4import { cn } from "@/lib/utils"56interface BorderBeamProps {7 className?: string8 size?: number9 duration?: number10 borderWidth?: number11 anchor?: number12 colorFrom?: string13 colorTo?: string14 delay?: number15}1617export function BorderBeam({18 className,19 size = 200,20 duration = 15,21 anchor = 90,22 borderWidth = 1.5,23 colorFrom = "#ffaa40",24 colorTo = "#9c40ff",25 delay = 0,26}: BorderBeamProps) {27 return (28 <div29 style={30 {31 "--border-width": `${borderWidth}px`,32 } as React.CSSProperties33 }34 className={cn(35 "pointer-events-none absolute inset-0 rounded-[inherit] [border:var(--border-width)_solid_transparent]",36 "![mask-clip:padding-box,border-box] ![mask-composite:intersect] [mask:linear-gradient(transparent,transparent),linear-gradient(white,white)]",37 className38 )}39 >40 <motion.div41 style={{42 width: size,43 height: size,44 background: `linear-gradient(to left, ${colorFrom}, ${colorTo}, transparent)`,45 offsetPath: `rect(0 auto auto 0 round ${size}px)`,46 offsetAnchor: `${anchor}% 50%`,47 }}48 initial={{ offsetDistance: "0%" }}49 animate={{ offsetDistance: "100%" }}50 transition={{51 duration,52 delay,53 repeat: Infinity,54 ease: "linear",55 }}56 className="absolute aspect-square"57 />58 </div>59 )60}
More from componentry
All 59 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Animated Gradientanimated-gradient | componentry | Components | Free | no deps | |
| ASCII Effectascii-effect | componentry | Components | Free | no deps | |
| Aurora Flowaurora-flow | componentry | Components | Free | no deps | |
| auth-modalauth-modal | componentry | Components | Free | no deps | |
| circuit-boardcircuit-board | componentry | Components | Free | no deps | |
| closing-plasmaclosing-plasma | componentry | Components | Free | no deps | |
| collection-surfercollection-surfer | componentry | Components | Free | no deps | |
| Command Menucommand-menu | componentry | Components | Free | no deps |
