Skip to content

Border Beam

A moving gradient border around your content.

LIVE PREVIEWInteract with the component
Just React. No extra dependencies.

Copy the component and its CSS module into your project.

CSS Modules

Usage

Matches your current playground settings.

jsx
import BorderBeam from "./BorderBeam";
export default function Example() {
return (
<BorderBeam
children={"Border Beam"}
color={"#ddd3ff"}
secondaryColor={"#7864e1"}
duration={6}
borderWidth={1}
borderRadius={16}
/>
);
}

Using Border Beam

Wrap the content you want to outline in children. Match borderRadius to the inner surface so the moving border follows its corners.

Use a longer duration for a quiet highlight. The border is decorative, so important states should still be communicated in the content.

Props

NameTypeRequiredDefaultDescription
childrenReactNodeNoundefinedYour content. No demo content is rendered by default.
colorstringNo"#b5f5d1"Beam color
secondaryColorstringNo"#7c83ff"Trail color
durationnumberNo6Duration
borderWidthnumberNo1Border width
borderRadiusnumberNo16Content supplied by your application.
classNamestringNo""Additional CSS class names, merged with base component styles.
styleCSSPropertiesNoundefinedInline styles for caller-defined sizing and visual overrides.

Related components

A soft highlight that follows the pointer across your card.

A paper flap lifts in 3D as a message slides out of its envelope.

A lightly textured receipt pairs precise item rows with a torn paper edge.

A suspended badge swings naturally after you drag and release its handle.