Documentation Index
Fetch the complete documentation index at: https://mintlify.com/tldraw/tldraw/llms.txt
Use this file to discover all available pages before exploring further.
Quick start
Get tldraw running in your React app in just a few steps. This guide walks you through creating a basic infinite canvas with the full tldraw UI and default tools.Basic setup
The simplest way to use tldraw is to import the<Tldraw /> component and render it with a fixed container:
The container must have explicit dimensions. Using
position: fixed with inset: 0 ensures the canvas fills the viewport.Complete example
Here’s a complete working example:App.tsx
- Full infinite canvas with pan and zoom
- Drawing tools (pencil, highlighter, eraser)
- Shape tools (rectangles, ellipses, arrows, text, sticky notes)
- Selection and manipulation tools
- Complete UI with toolbars, menus, and panels
- Undo/redo functionality
- Keyboard shortcuts
- Multi-touch and pen support
Accessing the editor instance
To interact with the canvas programmatically, access theEditor instance using the onMount callback:
Storing the editor reference
To access the editor instance outside the component, store it in a ref or state:Persisting canvas data
By default, tldraw stores canvas data in memory and the browser’s IndexedDB. To implement custom persistence:Common container patterns
Default features
The<Tldraw /> component includes:
Tools
- Select - Select and manipulate shapes
- Hand - Pan around the canvas
- Draw - Freehand drawing with pressure sensitivity
- Eraser - Remove drawn segments
- Arrow - Connect shapes with arrows
- Text - Add rich text
- Note - Create sticky notes
- Geo shapes - Rectangles, ellipses, diamonds, hexagons, stars, and more
- Line - Straight lines
- Frame - Group shapes in frames
- Highlight - Transparent highlighter
- Laser - Temporary pointer (disappears after drawing)
UI components
- Toolbar - Quick access to shape and drawing tools
- Style panel - Customize colors, sizes, and other properties
- Main menu - File operations and preferences
- Context menu - Right-click options
- Zoom menu - Zoom controls
- Page menu - Multi-page support
- Helper buttons - Undo, redo, and other quick actions
Built-in features
- Pan and zoom (mouse wheel, trackpad, touch)
- Multi-selection with shift-click or drag
- Precision snapping to shapes and guides
- Arrow binding to shapes
- Edge scrolling when dragging near viewport edges
- Undo/redo with keyboard shortcuts
- Copy/paste with formatting
- Image and video embedding
- Export to PNG, SVG, and JSON
Next steps
Now that you have a working canvas, explore how to customize and extend tldraw:Custom shapes
Create custom shape types
Custom tools
Build custom interaction tools
Editor API
Control the canvas programmatically
UI customization
Customize the user interface
Starter templates
For framework-specific setup with best practices, use the tldraw CLI:- Multiplayer - Real-time collaboration with
@tldraw/sync - Agent - AI agents that interact with the canvas
- Workflow - Node-based visual programming
- Chat - AI chat with canvas integration
- Vite - Minimal Vite + React setup
- Next.js - Next.js App Router setup
- Vue - Vue.js integration
Need help? Join the tldraw Discord to ask questions and get support from the community.