Animated border spotlight that travels around a rounded container edge, powered by Motion. A React component.
Made by AxylExamples
Border Trail Loading Card
Border Trail Textarea
Installation
File Structure
Usage
BorderTrail is a client component and decorative overlay. The parent must be relative with a matching border-radius (the trail inherits rounding via rounded-[inherit]).
When prefers-reduced-motion: reduce is set, the looping trail is replaced by a subtle static ring. Finite animations (e.g. the loading card) still call onAnimationComplete after the equivalent duration. See Accessibility.
Props
| Prop | Type | Default |
|---|---|---|
size? | number | 60 |
transition? | Transition | - |
onAnimationComplete? | () => void | - |
className? | string | "bg-zinc-500" |
style? | CSSProperties | - |
When to Use
Use BorderTrail to draw attention to a selected card, active form field, or featured section. Common patterns: loading skeleton cards that feel alive while data fetches, focused textareas that need stronger visual feedback than a plain outline, and featured cards in a grid that should stand out from inactive siblings.
Avoid applying it to every card simultaneously — the spotlight loses meaning when nothing is actively selected.
Accessibility
BorderTrail is a decorative overlay with no semantic role or interactive affordance. Screen readers ignore it. When prefers-reduced-motion: reduce is set, the looping animation is replaced by a static ring so the visual hint remains without motion.
Credits
Inspired by motion-primitives Border Trail.
Built by Axyl. A motion-first component registry for React.
Last updated: 7/26/2026