115 Components

Moving Text Border

Cards

Kinetic card wrapper with animated typography continuously flowing along the rounded perimeter using SVG textPath, dynamic geometry calculation, and zero-distortion responsiveness.

NewSVG textPathBorder AnimationKinetic
/r/moving-text-border.json
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 />.

11 props
PropTypeDefaultDescription
childrenReact.ReactNode—Content displayed inside the card wrapper.
textstring"AVAILABLE FOR WORK • AVAILABLE FOR WORK • "Text string continuously marching around the perimeter.
durationnumber12Duration in seconds for one complete circuit around the card.
reversebooleanfalseWhether text flows counter-clockwise instead of clockwise.
textColorstring"#a78bfa"Fill color of the perimeter typography.
fontSizenumber10Font size in pixels for the SVG text.
letterSpacingnumber2Letter spacing in pixels between characters.
borderRadiusnumber16Corner radius in pixels for the card and SVG path.
trackColorstring—Optional background guide path stroke color.
glowbooleanfalseWhether to apply a soft Gaussian blur ambient glow filter to the text.
autoRepeatbooleantrueWhether 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.