This Fabric.js FAQ answers the questions developers search for most. Each answer links to the page that covers it in depth.
How do I save a canvas as JSON and load it back?
Call engine.toDocument() to save a canvas as JSON, and engine.loadDocument(json) to load it. With a storage adapter, use engine.save() and engine.load(id). See save and load.
Does Fabric.js have undo redo?
No. Fabric.js has no built-in history. This package records one undo redo step per user action, and you call engine.undo() and engine.redo(). See undo and redo.
Why are my custom properties lost after loading?
Fabric.js only saves the properties it knows. Register your class with the extra properties, and the engine keeps them on every save and load. See custom objects.
How do I find an object by id?
Every object gets a stable id. Call engine.getObjectById(id). It also finds objects inside groups.
Can I use it with React, Vue or Svelte?
Yes. React has its own hooks in fabricjs-document-engine/react. Vue, Svelte and other frameworks use createDocumentStateStore(engine). See React, Vue and Svelte.
Does it work with Next.js?
Yes. The React entry is marked 'use client'. Fabric.js needs a browser, so render the editor in a client component. See Next.js.
Which Fabric.js versions are supported?
Fabric.js 6 and 7. Plain JSON saved by Fabric.js 5 also opens. See compatibility.
Do I need a server?
No. The built-in localStorage adapter works without one. For a real app, write a storage adapter for your own API with two functions. See custom backend.
Why does export fail with a tainted canvas error?
An image from another site was loaded without CORS. The engine checks this before exporting and names the image. See export.
Can two people edit at the same time?
Not live. The engine detects when another tab or device saved first, and lets the user reload or keep their version. See save conflicts.
Is it free?
Yes. It is MIT licensed. If this Fabric.js FAQ did not answer your question, open an issue on GitHub.