Programmatic Control

Runtime editor API

Programmatic Control

Runtime editor API

Direct programmatic control over your canvas application during runtime.

Shape operations

Create, modify, and remove shapes programmatically with full validation and consistency. Perfect for content generators, import systems, and automated drawing tools.

Selection management

Control user focus by programmatically managing selections and highlights. Guide users’ attention through complex documents and coordinate multi-step workflows.

Camera control

Direct viewport positioning and zoom levels with smooth animations. Build guided tours, presentation modes, and focus systems that automatically highlight relevant content.

Batch transactions

Group multiple operations into atomic changes with clean undo/redo boundaries.

Real-time queries

Access live canvas state through reactive queries that update automatically.

Event integration

Build analytics systems, collaboration features, and custom interaction patterns by hooking into editor events and state changes.

Build canvas apps that work

Runtime APIs handle content generation, guided tours, and automated drawing workflows.

Quick start with multiplayer

Production ready starter kit to build a canvas application with multiplayer. Building something different?

Multiplayer starter kit

Self-hosted tldraw with real-time multiplayer collaboration built with Cloudflare Durable Objects. Production-ready backend that handles WebSocket connections, automatic persistence, and asset management. The same architecture that powers hundreds of thousands of collaborative sessions on tldraw.com.

Multiplayer starter kit

Self-hosted tldraw with real-time multiplayer collaboration built with Cloudflare Durable Objects. Production-ready backend that handles WebSocket connections, automatic persistence, and asset management. The same architecture that powers hundreds of thousands of collaborative sessions on tldraw.com.

Solid engineering

Our team spent years to get all the details right, so you don’t have to.

Advanced selection and focus system

The system enables precise control of user attention through programmatic selection and focus management. It supports complex selection patterns, hierarchical focus within groups, and intelligent viewport coordination. Selection integrates smoothly with keyboard navigation, accessibility features, and collaborative cursor management.

Comprehensive shape lifecycle management

The editor provides complete control over shape creation, modification, and deletion with the same validation and consistency guarantees as user interactions. Programmatic operations automatically respect shape relationships, maintain bindings, and trigger the correct side effects across the canvas. The API also provides type-safe methods for bulk actions, transaction management, and constraint validation.

Professional camera and viewport control

The system offers advanced camera control with smooth animations, intelligent bounds handling, and seamless viewport transitions. It provides precise coordinate control, configurable easing functions, and automatic conflict resolution between programmatic and user-driven changes. All operations adapt to responsive design constraints and device-specific interaction patterns.

Asset handling and storage integration

Large assets like images and videos are handled separately from real-time synchronization to maintain performance. Files are uploaded to cloud storage (R2) and cached on Cloudflare's edge network. In this way, loading is fast worldwide, and WebSocket connections stay focused on lightweight canvas interactions data.

Zach Blodgett,

Staff Product Manager at

“tldraw’s technology enabled us to deliver a high-quality foundation and also develop native functionality ourselves. The technology and team have been great to work with.”

ClickUp modernized its whiteboard for millions of users, replacing legacy infrastructure with the tldraw SDK.

Zach Blodgett,

Staff Product Manager at

“tldraw’s technology enabled us to deliver a high-quality foundation and also develop native functionality ourselves. The technology and team have been great to work with.”

ClickUp modernized its whiteboard for millions of users, replacing legacy infrastructure with the tldraw SDK.

Examples

See for yourself

Have a look at our examples on how to implement UI customization features.

Canvas control API

Manipulate canvas contents with shape creation, selection, and camera control through the editor API.

Lock camera zoom

Programmatically zoom the camera to specific areas with precise bounds control and animation options.

Create arrow between shapes

Use the editor API to programmatically create arrows and bindings between shapes.

Endless room to explore

From small sketches to sprawling systems, the canvas adapts to your needs.

Join the community

45K

Source available on

72K

followers on

...

weekly downloads on

8.75K

members on

Join the community

45K

Source available on

72K

followers on

...

weekly downloads on

8.75K

members on

© 2026 tldraw

© 2026 tldraw

© 2026 tldraw