ConfigsApr 7, 2026·2 min read

tldraw — Infinite Canvas SDK for AI Applications

Open-source infinite canvas library for building whiteboard, diagramming, and design applications. React component with real-time collaboration. Used by AI tools for visual generation. 40,000+ stars.

TL;DR
Open-source infinite canvas React library for whiteboard, diagramming, and design apps with real-time collaboration and AI tool integration.
§01

What it is

tldraw is an open-source infinite canvas library for building whiteboard, diagramming, and design applications. It provides a React component with drawing tools, shape primitives, text, images, and real-time collaboration out of the box.

tldraw is used by AI tools for visual generation, letting users sketch interfaces or diagrams that AI can interpret and convert to code or structured data. The library has over 40,000 GitHub stars and is used in production by multiple companies.

§02

How it saves time or tokens

Building a canvas editor from scratch requires handling pointer events, coordinate transforms, shape rendering, undo/redo, selection, snapping, and multi-user sync. tldraw provides all of this as a single React component. Drop it into your app and you have a working canvas editor.

For AI applications, tldraw's structured shape data means you can export a user's drawing as JSON and feed it to an LLM for interpretation, reducing the need for expensive vision model calls.

§03

How to use

  1. Install tldraw:
npm install tldraw
  1. Add the canvas to your React app:
import { Tldraw } from 'tldraw';
import 'tldraw/tldraw.css';

export default function App() {
  return (
    <div style={{ width: '100vw', height: '100vh' }}>
      <Tldraw />
    </div>
  );
}
  1. Customize tools, shapes, and UI using tldraw's extensibility API.
  1. Export canvas state as JSON for processing by AI models or backend services.
§04

Example

import { Tldraw, useEditor } from 'tldraw';

function ExportButton() {
  const editor = useEditor();
  const handleExport = () => {
    const shapes = editor.getCurrentPageShapes();
    console.log(JSON.stringify(shapes, null, 2));
  };
  return <button onClick={handleExport}>Export Shapes</button>;
}

function App() {
  return (
    <Tldraw>
      <ExportButton />
    </Tldraw>
  );
}
§05

Related on TokRepo

§06

Common pitfalls

  • Not importing the CSS file. tldraw requires tldraw/tldraw.css for proper rendering. Without it, the canvas renders but tools and menus are unstyled.
  • Treating tldraw as a vector graphics editor. It is a canvas SDK for building custom editors, not a replacement for Figma or Illustrator. Use the extensibility API to build the editor your users need.
  • Ignoring performance with large shape counts. Canvases with thousands of shapes may need viewport culling and pagination strategies.
  • Failing to review community discussions and changelogs before upgrading. Breaking changes in major versions can disrupt existing workflows. Pin versions in production and test upgrades in staging first.

Frequently Asked Questions

What is tldraw used for?+

tldraw is used for building whiteboard applications, diagramming tools, visual collaboration platforms, and AI-powered design tools. It provides the canvas rendering, shape management, and interaction handling so you can focus on your application logic.

How does tldraw integrate with AI?+

tldraw exports canvas state as structured JSON. AI applications can read this JSON to interpret user drawings, convert sketches to code, or generate design suggestions. Some AI tools use tldraw as an input canvas where users sketch UI mockups that an LLM converts to working code.

Does tldraw support real-time collaboration?+

Yes. tldraw includes built-in support for real-time collaboration using WebSocket sync. Multiple users can draw on the same canvas simultaneously with live cursor and selection visibility.

Can I customize tldraw shapes and tools?+

Yes. tldraw has an extensibility API for creating custom shapes, tools, and UI components. You can add domain-specific shapes (like flowchart nodes or UML elements) and custom interaction behaviors while keeping the core canvas functionality.

Is tldraw free for commercial use?+

tldraw uses a dual license. The core library is open-source, but commercial use may require a license depending on your deployment model. Check the tldraw license terms for your specific use case.

Citations (3)
🙏

Source & Thanks

Created by tldraw. Licensed under Apache 2.0.

tldraw — stars 40,000+

Thanks for making the infinite canvas a React component.

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets