Writing Text Effect
v1.0An elegant SVG path animation that mimics handwriting using Framer Motion.
Live Preview
Customize text and font to see the animation.
Install Dependencies
npx shadcn@latest add https://raw.githubusercontent.com/rimu-7/shadcn-components/main/public/registry/text-writing-effect.jsonComponent Code
Copy the code below into components/ui/text-writing-effect.tsx
How it Works
This component uses Framer Motion to animate the SVG stroke-dashoffset property.
- First, it renders the text outline (stroke) and animates it from 0 to 100%.
- Then, it fades in the fill color to make the text solid.
- It uses
next/fontto support any Google Font.
Props
textRequiredstring
The text to display.
fontClassNamestring
Class from next/font.
speednumber
Duration in seconds. Default: 2
colorstring
Stroke/Fill color. Default: currentColor
strokeWidthnumber
Thickness of the line. Default: 1.5