115 Components
Moving Text Border
CardsKinetic card wrapper with animated typography continuously flowing along the rounded perimeter using SVG textPath, dynamic geometry calculation, and zero-distortion responsiveness.
NewSVG textPathBorder AnimationKinetic
RB
Rishabh Bose
UI Engineer and Frontend Developer
Available Now
Installation
Install directly into your project using the shadcn CLI or copy the source code manually.
Requires:framer-motionclsxtailwind-merge
$npx shadcn@latest add "https://boseui.site/r/moving-text-border.json"
Props
TypeScript props supported by <MovingTextBorder />.
| Prop | Type | Default | Description |
|---|---|---|---|
| children | React.ReactNode | — | Content displayed inside the card wrapper. |
| text | string | "AVAILABLE FOR WORK • AVAILABLE FOR WORK • " | Text string continuously marching around the perimeter. |
| duration | number | 12 | Duration in seconds for one complete circuit around the card. |
| reverse | boolean | false | Whether text flows counter-clockwise instead of clockwise. |
| textColor | string | "#a78bfa" | Fill color of the perimeter typography. |
| fontSize | number | 10 | Font size in pixels for the SVG text. |
| letterSpacing | number | 2 | Letter spacing in pixels between characters. |
| borderRadius | number | 16 | Corner radius in pixels for the card and SVG path. |
| trackColor | string | — | Optional background guide path stroke color. |
| glow | boolean | false | Whether to apply a soft Gaussian blur ambient glow filter to the text. |
| autoRepeat | boolean | true | Whether to automatically repeat the text to fill the entire card perimeter. |
Key Features
- Dynamic ResizeObserver geometry: recalculates the rounded-rect path on container resize for distortion-free letterforms.
- Hardware-accelerated SVG textPath animation with configurable loop duration and flow direction.
- Automatic perimeter tiling and repetition to seamlessly loop around cards of any aspect ratio.
- Unique instance-scoped SVG def IDs via React useId preventing collisions when multiple instances are mounted.
- Customizable typography styling (fill color, font size, letter spacing, font weight) and optional ambient glow.
- Respects system prefers-reduced-motion settings by halting rotation.
Keyboard & Accessibility
- Decorative perimeter SVG is marked with aria-hidden='true' to prevent screen-reader spam.
- Respects prefers-reduced-motion by freezing text translation.
- Preserves natural DOM order and keyboard tab flow for wrapped child content.