Ir al contenido
Español
Tarjeta con borde animado viene con Pro. La vista previa aparece al desbloquearlo.

Cómo funciona

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.

Úsalo para

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

Busca otra opción cuando

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

Uso

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>
  )
}

Propiedades

PropiedadTipoPor defectoQué hace
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.

Accesibilidad

  • 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.

Movimiento

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.

Añádelo a tu proyecto

Los miembros Pro copian un prompt y su agente de programación instala el código, igual que con los gratuitos.

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

Los dos archivos se instalan juntos. La hoja de estilos lee las variables de tokens.css y lleva valores de reserva, así que también funciona sola.

Tarjetas
Borde con haz de luz viene con Pro. La vista previa aparece al desbloquearlo.
Tarjeta con hoja de datos viene con Pro. La vista previa aparece al desbloquearlo.
Sobre que se abre viene con Pro. La vista previa aparece al desbloquearlo.