Skip to content
English
Animated border card comes with Pro. Its preview shows once you unlock it.

How it works

The border is the root's padding showing two background layers: a pointer light over a conic gradient that a registered angle turns, with no spinning oversized element. Most of the conic is the plain border colour and one long arc carries the palette, so at rest the card is calm and its edge only quietly alive. One window listener, throttled to animation frames, writes where on the edge the pointer is closest and how near it is (0 to 1); the border, a blurred glow underneath and a faint wash inside all brighten together as the pointer approaches.

Use it for

  • The one recommended option among several, such as a plan or a template.
  • A featured card that should invite the pointer without shouting.

Look elsewhere when

  • Every card in a grid: the highlight loses its meaning.
  • Error or warning states: use a plain coloured border.

Usage

import { AnimatedBorderCard } from './AnimatedBorderCard.jsx'

export function RecommendedPlan() {
  return (
    <AnimatedBorderCard as="article" palette="aurora" speed={8} proximity={160}>
      <div style={{ padding: 24 }}>
        <h3>Studio</h3>
        <p>For small teams shipping every week.</p>
      </div>
    </AnimatedBorderCard>
  )
}

Props

PropTypeDefaultWhat it does
childrenReactNode—Card content; give it its own padding.
palette'aurora' | 'sunset' | 'mono''aurora'Colours of the travelling arc.
speednumber8Seconds per full turn (minimum 1).
borderWidthnumber1.5Border thickness in px.
proximitynumber160Distance in px at which the pointer starts to light the border; 0 turns it off.
glowbooleantrueSoft coloured glow under the card.
asElementType'div'Root element.

Accessibility

  • Purely decorative: the border, glow and pointer light carry no information, and the card renders its children unchanged.
  • The pointer effect listens passively and only on devices that hover; keyboard and touch users see the turning border alone.
  • Forced-colors mode draws a solid border in the text colour.
  • Reduced motion stops the turn and parks the arc on the top-right edge; the pointer light still responds, without movement.

Motion

The arc turns linearly once every 8s (adjustable), which reads as a slow drift. The glow under the card eases between strengths over 360ms; the pointer light follows every animation frame.

Add it to your project

Pro members copy a prompt and their coding agent installs the source, the same way as the free components.

AnimatedBorderCard.jsxanimated-border-card.csstokens.cssREADME.md

Both files install together. The stylesheet reads the design tokens in tokens.css and carries fallbacks, so it also works alone.

Cards
Border beam comes with Pro. Its preview shows once you unlock it.
Card lock sheet comes with Pro. Its preview shows once you unlock it.
Envelope open comes with Pro. Its preview shows once you unlock it.