Programmatic Control

Create and update shapes with complete control

Programmatic Control

Create and update shapes with complete control

Create and update shapes with automatic handling of positioning, parenting, and batch operations, even in complex scenarios.

Partial updates

Shape properties with partial objects that merge with existing data. Perfect for building reactive applications where shapes respond to data changes or user interactions.

Type-safe creation

Create shapes programmatically with automatic IDs, parent detection, and property validation. The system applies editor styles and keeps layer ordering consistent.

Coordinate transforms

Automatic coordinate space conversion between page, parent, and local coordinates. Build applications that position shapes precisely without manual transform calculations.

Smart parenting

Automatic parent detection based on shape positioning and containment rules. Shapes find appropriate containers while respecting type compatibility and hierarchy constraints.

Shape complexity, solved

APIs handle positioning and transforms so your canvas apps stay reactive and predictable.

Automatic parent detection

The creation system processes shapes through validation, parent assignment, coordinate transformation, and property merging. Shapes receive auto-generated IDs if none are provided, determine their parents based on position and containment rules, and are placed at the correct z-index in the hierarchy. Current editor styles are applied automatically, with type-specific properties validated through shape utilities.

Lock enforcement and validation

Shape updates use partial objects that merge with existing shape data while respecting lock states and maintaining referential integrity. The system validates each update against shape schemas, removes invalid changes, and processes multiple updates as atomic operations. Animation cleanup ensures manually updated shapes are removed from active animations for consistent behavior.

Automatic transforms

The transform system manages conversions between page space, parent space, and shape-local coordinates using cached transformation matrices. When shapes are reparented, their page coordinates are preserved through automatic space conversion. Efficient matrix caching allows it to handle complex nested hierarchies without requiring manual calculations.

Starter kits

Production ready starter kit to integrate agents into your canvas. Building something different?

Workflow starter kit

Build visual tools where users drag, connect and execute nodes to build automation pipelines within a canvas interface. Set up your first workflow builder in minutes, then customize nodes and behaviors for your specific use case. Drag-and-drop nodes, automatic connection routing, and execution management out of the box.

Workflow starter kit

Build visual tools where users drag, connect and execute nodes to build automation pipelines within a canvas interface. Set up your first workflow builder in minutes, then customize nodes and behaviors for your specific use case. Drag-and-drop nodes, automatic connection routing, and execution management out of the box.

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 control shape creation and updates programmatically.

Controlling the canvas

Build programmatic shape creation and updating workflows.

Before create/update shape

Intercept the creation or update of any record in the store and return a new record to be used in it place.

After create/update shape

Register handlers to run after any record is created or updated.

Shape control without the hassle

From creation to transforms, the system keeps everything in order.

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