Skip to content
caliper ui docs

Pro

Draw on

Wraps an inline SVG so its strokes draw themselves in, one after another, when it scrolls into view. Nodes can fade in after their line arrives.

Pro
pnpm dlx shadcn@latest add @caliper/draw-on

Release v2.14

Shipped to production on Tuesday 20 October at 16:42

CommitBuild3 checksProduction
Installs components/ui/draw-on.tsxDepends on none beyond ReactMotion none in component source

When to use

Use it for

  • Diagrams, routes and underlines that tell a story in order.
  • A check mark or chart line that should feel drawn, not placed.

Skip it when

  • Icons and anything in a list; drawing is for a moment, not for rows.
  • Filled artwork; only strokes draw.

Decisions

Why it is built this way, so you know what to keep when you change your copy.

Behaviour

Order is document order
Each stroke starts 140ms after the one before it, so the order you write the shapes in is the story the drawing tells. Nothing is communicated by order alone.
Without script it is already drawn
Strokes only start hidden once the part is ready, so a page without JavaScript, and reduced motion, show the finished drawing.

Usage

Replay with a key
Change the key to play it again. The SVG still needs its own accessible name.

Installation

terminal
pnpm dlx shadcn@latest add @caliper/draw-on

Adds its 2 files to components/ui/, each with its own stylesheet, and installs their packages. Pro installs with your access token, set up once per project. See Pro access. The first part also adds Caliper UI’s tokens; import them once as in Installation.

Usage

Import it from your copy of the source. The example behind the preview comes with the source.

example.tsx
import { DrawOn } from "@/components/ui/draw-on"

The worked example comes with Pro

The 45-line example behind the preview opens here, ready to copy.

  • 626 Pro parts, blocks and page templates, all with source
  • $149 once, with lifetime updates. No renewal
  • A full refund within 14 days if it is not for you
Checking your licence…

API reference

DrawOn

component

Also accepts the native props of its root element and a ref.

PropTypeDefaultDescription
staggernumber140Delay between one shape starting and the next, in milliseconds.
oncebooleantrueDraw the first time it enters view (true), or every time it does (false).
thresholdnumber0.35How much of it must be in view to start, from 0 to 1.

Accessibility

It is built on native elements, so roles and focus come from the browser.

No custom key handling; Tab and the native activation keys do the work.

Motion

It declares no animation in its component source. Any transition comes from its stylesheet, which uses the duration tokens that collapse to instant under prefers-reduced-motion.

All Surfaces examples