Skip to content
Template Empire
Browse components

SVG Outline Draw

A free SVG text animation for React that draws its outline once.

Outline the future

Customise

1.15s
0.6s
3
112
0

Code

<TextSvgOutlineDraw>
  Outline the future
</TextSvgOutlineDraw>

SVG Outline Draw is a free text effect for Next.js and React that draws a responsive SVG outline once, along each glyph's own length, then settles into a semantic-token fill. Tailwind controls the surrounding layout while Motion animates only the stroke dash offset and the fill opacity, once, when the text scrolls into view, and leaves nothing of the draw behind once it is done.

It gives teams looking for an SVG text animation React can render safely a semantic heading, a decorative fixed-viewBox visual, and a complete server-rendered fallback. Reduced-motion and no-JavaScript visitors receive the final filled and outlined text immediately, while the visible SVG stays hidden from assistive technology.

Install

Add the @te registry to your components.json once:

{
  "registries": {
    "@te": "https://templateempire.io/r/{name}.json"
  }
}

Then install the component:

npx shadcn@latest add @te/text-svg-outline-draw

Usage

import { TextSvgOutlineDraw } from "@/components/text-svg-outline-draw";

export function Example() {
  return (
    <TextSvgOutlineDraw
      as="h1"
      direction="forward"
      drawDuration={1.15}
      fillDelay={0.6}
      strokeWidth={3}
      fontSize={112}
      letterSpacing={0}
      className="font-semibold"
    >
      Outline the future
    </TextSvgOutlineDraw>
  );
}

Props

PropTypeDefaultDescription
childrenstringrequiredPlain display text rendered once for assistive technology.
asElementType"h2"Semantic wrapper element.
direction"forward" | "reverse""forward"Which end of each glyph outline the stroke is drawn from: its start (forward) or its end (reverse).
drawDurationnumber1.15Draw duration in seconds, clamped from 0.45 to 2.4.
fillDelaynumber0.6Seconds before the fill begins, clamped from 0 to 0.8 and never later than the draw. The default shows the outline drawing for about half the draw before the fill lands.
strokeWidthnumber3Outline width in SVG units, clamped from 0.5 to 4. The default stays visible beside the fill at phone widths.
fontSizenumber112Visual font size in SVG units, clamped from 64 to 150.
letterSpacingnumber0Visual letter spacing in SVG units, clamped from -2 to 10.
classNamestringundefinedAdditional classes merged onto the semantic wrapper.

Customisation

Override --outline-draw-stroke for the animated outline and --outline-draw-fill for the settled fill. Both tokens retain semantic vanilla CSS fallbacks. Use direction, duration, delay, stroke width, font size, and letter spacing props to tune the actual effect without turning preview wording into a control:

:root {
  --outline-draw-stroke: var(--primary);
  --outline-draw-fill: var(--foreground);
}

Frequently asked questions

Is SVG Outline Draw free for commercial use?
Yes. SVG Outline Draw is MIT licensed, so you can use it in personal and commercial projects without attribution.
Is SVG Outline Draw accessible and reduced-motion safe?
Yes. The semantic wrapper owns one visually hidden copy of the text, while the SVG and its text are decorative and hidden from assistive technology. With reduced motion nothing is animated, and the final fill and outline are visible immediately.
How can I customise the outline drawing effect?
Use direction, drawDuration, fillDelay, strokeWidth, fontSize, and letterSpacing to tune the motion and geometry. Set --outline-draw-stroke and --outline-draw-fill on the component or an ancestor to retheme it with semantic colours.

Related components

Want the full page this belongs to?Template Empire builds complete Next.js templates with this motion system across every section. Explore the templates that pair with this free text effect.Explore Template Empire templates