Handwriting SVG

SVG path that draws itself on mount. Pass path for custom shapes or text to render handwriting.

Last updated Mar 5, 2026

Component

Installation

pnpm dlx shadcn@latest add "https://pulkitxm.com/components/handwriting-svg.json"

Usage

Import

Add the HandwritingSvg import.

import { HandwritingSvg } from "@/components/handwriting-svg";

Path

Use with path for custom SVG.

<HandwritingSvg path="M50 10 L90 50 L50 90 L10 50 Z" />;

Text

Or use text for handwriting rendering.

<HandwritingSvg text="Hello" />;

Guidelines

  • Use path for custom SVG path data (d attribute).
  • Use text to render text as handwriting; requires fontUrl (default: Indie Flower).
  • Animates on mount. duration and delay control timing.

Props

All props are optional unless marked required. Use these to customize every aspect of the component.

PropTypeDefaultDescription
classNamestringAdditional CSS classes for the SVG (e.g. text-rose-500 for stroke).
strokeClassNamestringClasses for the animated path stroke.
pathstringCustom SVG path (d attribute). Use when not using text.
textstringText to render as handwriting. Uses opentype.js with fontUrl.
fontUrlstringIndie Flower TTF URLFont URL for text rendering. TTF or OTF.
durationnumber2Draw animation duration in seconds.
delaynumber0.5Delay before animation starts (seconds).
ease"linear" | "easeIn" | "easeOut" | "easeInOut""easeInOut"Animation easing: linear, easeIn, easeOut, easeInOut.
widthnumber100SVG width in pixels.
heightnumber100SVG height in pixels.
fontSizenumber48Font size for text rendering.
strokeWidthnumber2Stroke width in pixels.

Examples

Path

Custom SVG path draws on mount.

import { HandwritingSvg } from "@/components/handwriting-svg";

<HandwritingSvg path="M50 85 C20 60 5 35 25 15 C40 0 50 15 50 15 C50 15 60 0 75 15 C95 35 80 60 50 85 Z" />;

Text input

Text rendered as handwriting using a font.

import { HandwritingSvg } from "@/components/handwriting-svg";

<HandwritingSvg text="Hi" className="text-amber-500" />
<HandwritingSvg text="Hello" width={120} height={60} />

Custom input

Type your name and click Draw to see it rendered as handwriting.

import { HandwritingSvg } from "@/components/handwriting-svg";

<HandwritingSvg text="Pulkit" />;

Made with ❤️ by Pulkit & Cursor :)

© 2026 Pulkit. All rights reserved

DMCA Verified

Last updated: