Skip to Content
Prisma UI - React component library
ComponentsComponentsBorder Beam Card

Border Beam

An animated beam of light that travels along the border of any Card. Inspired by Magic UI’s Border Beam . Implemented with pure CSS — no external animation library required.

Installation

npx shadcn@latest add https://prismaui.com/components/border-beam.json

Import

import { BorderBeam } from '@/components/ui/border-beam'; import { Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter, } from '@/components/ui/card';

Preview

Border Beam

An animated beam travels along the border.

Drop <BorderBeam /> inside any Card with relative overflow-hidden.

<Card className='relative w-85 overflow-hidden'> <BorderBeam /> <CardHeader> <CardTitle>Border Beam</CardTitle> <CardDescription> An animated beam travels along the border. </CardDescription> </CardHeader> <CardContent> <p className='text-sm text-muted-foreground'> Drop &lt;BorderBeam /&gt; inside any Card with relative overflow-hidden. </p> </CardContent> <CardFooter> <Button size='sm'>Action</Button> </CardFooter> </Card>

Custom Colors

Custom Colors
Blue gradient, faster speed.

Customize the beam colors and speed with props.

Reversed Beam
Gold colors, reversed direction.

Use the reverse prop to flip the beam direction.

<Card className="relative overflow-hidden"> <BorderBeam colorFrom="#00c6ff" colorTo="#0072ff" duration={4} /> ... </Card> <Card className="relative overflow-hidden"> <BorderBeam colorFrom="#f7971e" colorTo="#ffd200" reverse /> ... </Card>

Double Beam

Stack two <BorderBeam /> instances with opposite directions and a delay offset for a more dynamic effect.

Double Beam
Two beams, opposite directions.

Stacking two beams with a half-period delay creates a symmetric loop.

<Card className='relative overflow-hidden'> <BorderBeam duration={6} /> <BorderBeam duration={6} delay={3} reverse /> ... </Card>

Props

PropTypeDefaultDescription
sizenumber50Size of the beam in pixels
durationnumber6Duration of one full loop in seconds
delaynumber0Delay before the animation starts
colorFromstring#ffaa40Start color of the beam gradient
colorTostring#9c40ffEnd color of the beam gradient
reversebooleanfalseWhether to reverse the animation direction
Last updated on