Skip to content

Border Beam for React

Border beam is an animated gradient border for React: a comet of light that runs around a rounded edge at one steady speed. Use it as a glowing border animation to mark the recommended plan in a pricing table, so one GlassCard carries a comet of light around its edge while the other tiers stay calm.

npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/border-beam.json

Deploying to production

Build 2f9c1a, 14 of 18 steps

Deploy steps
x

On a glass card

Drop it inside any positioned, rounded element: it takes the parent's radius and sits on its border. paused holds the beam exactly where it is.

Deploying to production

Build 2f9c1a · 14 of 18 steps

Live

Files to copy

4 folders · 4 files · 4 packages
From theme/src/
  • components/border-beam/
  • hooks/{use-intersection.ts, use-media-query.ts, use-preferences.ts}
  • lib/cn.ts
  • styles/
shadcn CLI
npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/border-beam.jsonRegistry item: border-beam. The styles need the Tailwind v4 glass UI setup.
The examples also use
  • components/button/
  • components/glass-card/
  • components/input/
  • components/spinner/
  • components/switch/
  • hooks/{use-direction.ts, use-latest.ts, use-magnetic.ts}
  • motion/{gate.ts, light-follower.ts, tokens.ts}
  • lib/{field-control-shell.tsx, field-size.ts, form.ts, heading.ts, motion-props.ts, state-light.tsx}
npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/button.json https://lokendra-builds.github.io/sheenui/r/glass-card.json https://lokendra-builds.github.io/sheenui/r/input.json https://lokendra-builds.github.io/sheenui/r/switch.json
Packages
pnpm add @base-ui/react clsx motion tailwind-merge

Wide bars, two beams, any color

On a wide search bar the beam keeps its pace along the long sides. double runs two beams on opposite sides; colors take any CSS color (here the warning and danger tokens).

2 alerts need attention

Props

PropTypeDefaultDescription
durationnumber8Seconds one lap around the border takes.
delaynumber0Seconds before the first lap (lets several beams run out of step).
lengthnumber120Length of the beam in px, measured along the border.
widthnumber1.5Sets the thickness of the ring in px.
colorFromstring"var(--sheen-accent)"Sets the tail colour (any CSS colour).
colorTostring"var(--sheen-accent-2)"Colour of the beam's bright head, any CSS colour; the tail fades in from colorFrom.
reversebooleanfalseRuns the beam anticlockwise instead of clockwise.
doublebooleanfalseDraws two beams on opposite sides.
glowbooleantrueSoft halo around the beam (skipped for lite glass and reduced transparency). It moves by transform; nothing is blurred per frame.
trackbooleantrueFaint, static rim under the beam, so the border reads as lit even between laps.
offsetnumber-1Distance from the parent's padding edge in px. -1 sits on a 1px border.
pausedbooleanfalseHold the beam where it is (it carries on from there when unpaused).
classNamestringNoneAdds extra classes to the beam element.
styleCSSPropertiesNoneInline style for the beam element (for example custom properties).

Keyboard

KeysAction
TabNot focusable: the beam is decoration.

Accessibility

  • Purely decorative: aria-hidden, no focus, no pointer events, and hidden in forced colors.
  • It sits on a card you provide, so contrast is that of the card. Under reduced motion it is a still beam lit on the top-left corner.

When to use the border beam effect

  • Use it on the recommended plan of a pricing table or one featured card in a grid, so a single comet of light circles that edge while its neighbours stay still.
  • Use it on a focused input wrapper or a primary call-to-action button to show an AI prompt box is live or that a card is selected, without adding a heavy glow.
  • Use double and reverse to make a featured tile look different from its neighbors, and delay to stagger several beams so they never run in lockstep.
  • Skip it when the surface is not a rounded element you control or you need a static highlight; a plain border, or SpotlightCard for a hover-driven glow, fits better than a looping animation.
  • Pair it with GlassCard as the parent, Badge for a Recommended label, and Button inside the card so the beam draws attention to the action rather than competing with it.

Frequently asked questions

19 effects pages in all: browse them on All effects.

By Lokendra Singh Rathore (GitHub, opens in a new tab). Published , updated .