Skip to main content

Now, to begin…

Firstly, install @tsdraw/react (it includes the core engine):
Then import the component and styles, and render:
You now have a functional canvas with drawing, erasing, selection, and panning. That’s literally it. Now, let’s add some more cool features…

Persistence

Persistence is when the state of the canvas stays constant. To enable persistence, pass a persistenceKey to the Tsdraw component. The state now lives in your browser.

Backgrounds

Want a grid, lines, or dots as the background of your canvas? Just pass a background prop to the Tsdraw component. I told you, tsdraw is truly that customizable.

The Editor

Now, to access the Editor instance, which manages shapes, tools, and the viewport, just pass a onMount callback to the Tsdraw component.

Next steps

Now that you have a working canvas: