React Curved Loop Text
Interactive curved text animation that follows an SVG path with drag controls and smooth scrolling effects. Perfect for dynamic marquees.
Looking to create curved text animations?
Join our Discord community for help from other developers.
Most text animations are limited to straight-line marquees that feel flat and predictable. This component creates curved text that flows along an SVG path with interactive drag controls, making typography feel more dynamic and engaging.
Curved path text animation
Text that flows smoothly along a curved path with interactive controls:
Built with TypeScript for React applications, using SVG textPath elements for smooth curved text rendering and pointer events for interactive drag functionality.
Installation
npx shadcn@latest add https://www.shadcn.io/registry/curved-loop.json
npx shadcn@latest add https://www.shadcn.io/registry/curved-loop.json
pnpm dlx shadcn@latest add https://www.shadcn.io/registry/curved-loop.json
bunx shadcn@latest add https://www.shadcn.io/registry/curved-loop.json
Usage
import CurvedLoop from "@/components/text/curved-loop";
<div className="flex items-center justify-center min-h-screen w-full p-4 sm:p-8">
<div className="relative w-full flex items-center justify-center px-4 sm:px-12">
<CurvedLoop
marqueeText="shadcn/ui ✦"
speed={2}
curveAmount={300}
direction="left"
interactive={true}
className="text-foreground"
/>
</div>
</div>
Why straight marquees are limiting
Traditional marquee effects move text in straight lines with basic CSS animations—predictable scrolling that doesn't take advantage of modern SVG capabilities. Flat text movement lacks visual interest and fails to create the dynamic, flowing feeling that curved paths provide.
This React component uses SVG textPath elements to flow text along curved paths with smooth animation loops. Users can drag to control direction and speed, creating an interactive experience that makes text feel alive and responsive to user input.
The key insight: curved text paths create more visually interesting animations. When text follows natural curves instead of rigid straight lines, it creates more engaging typography experiences that feel organic and interactive.
Features
- Smooth curved text animation following SVG paths with customizable curve intensity
- Interactive drag controls for real-time direction and speed manipulation
- Automatic text wrapping and spacing calculations for seamless loops
- Configurable animation speed with left/right directional control
- Responsive design with proper touch and pointer event handling
- Custom curve amounts and interactive mode toggling for different use cases
- Free open source component compatible with Next.js and shadcn/ui design systems
API Reference
CurvedLoop
Interactive curved text component with drag controls and path animation.
Prop | Type | Default | Description |
---|---|---|---|
marqueeText | string | '' | Text content to display along curve |
speed | number | 2 | Animation speed in pixels per frame |
curveAmount | number | 400 | Intensity of the curve bend |
direction | 'left' | 'right' | 'left' | Initial animation direction |
interactive | boolean | true | Enable drag controls for user interaction |
className | string | - | Additional CSS classes for text styling |
Animation Controls
Interactive features for user engagement:
Control | Action | Effect |
---|---|---|
Drag | Click and drag horizontally | Changes direction and speed |
Release | Let go after dragging | Continues in drag direction |
Cursor | Hover over component | Shows grab/grabbing cursor |
Curve Configuration
Path shape customization options:
Property | Range | Effect | Best For |
---|---|---|---|
curveAmount | 0-800 | Curve intensity | Subtle (100-300), Dramatic (400-800) |
speed | 0.5-10 | Animation velocity | Slow reading (0.5-2), Fast motion (3-10) |
Common gotchas
Text not appearing: The component calculates text length dynamically. Ensure your text has content and the font loads properly. Very short text might need adjustment to the spacing calculations.
Choppy animation: SVG text animations can be performance-intensive. For very long text or multiple instances, consider reducing the speed or using fewer simultaneous animations on the same page.
Touch interaction issues: The component uses pointer events for broader device support. On some touch devices, scrolling might interfere with drag controls. Consider adjusting the interactive prop for mobile-specific implementations.
Curve not visible: Very small curve amounts (under 50) might appear straight. Very large amounts (over 600) might push text outside the viewBox. Adjust curveAmount based on your container size and desired visual effect.
Text wrapping problems: The component automatically calculates text repetition for seamless loops. Custom fonts or unusual character spacing might affect these calculations, requiring manual adjustment of the spacing logic.
Integration with other components
Perfect for hero sections with Card layouts or dynamic headers in marketing pages. The curved animation works excellently as accent elements in Dialog modals or as interactive navigation elements.
For creative interfaces, combine with other text components for layered typography effects. The component pairs well with Badge components for categorized content and works beautifully in Sheet overlays for dynamic branding elements.
Questions developers actually ask
React Counting Number
React counting number component with spring animations. TypeScript counters with in-view detection and decimal support for Next.js apps using shadcn/ui.
React Decrypted Text Effect
Matrix-style text decryption animation with character scrambling, sequential reveal patterns, and customizable trigger modes. Perfect for cyberpunk interfaces.