Fabric.js adds an interactive object model on top of the canvas element. It supports drawing, SVG interchange, serialization, filters, and browser or Node.js use.
Overview
Fabric.js is a JavaScript library for working with the HTML5 canvas in browsers and in Node.js through dedicated packages. It wraps shapes, images, text, and groups in objects you can move, scale, rotate, skew, and serialize to JSON, JPG, PNG, or SVG.
Built-in capabilities include gradients, patterns, brushes, image filters, animations, clipping paths, viewport zoom and pan, object caching, and on-canvas controls for transformation. Complex SVG paths can be imported and drawn; the library also parses between SVG and canvas representations.
Modern installs use @fabricjs/browser or @fabricjs/node entrypoints, with @fabricjs/core sharing runtime code between environments. Node usage relies on node-canvas and jsdom, with a documented minimum Node.js version for current releases. The codebase is TypeScript-based and tested across major Chromium browsers, Firefox, Safari, and Opera.
Website-documented features add rich on-canvas text editing, WebGL and Canvas2d image filters, tweening animations, and flexible custom controls. Applications range from design tools to automation pipelines that render graphics server-side.
Key features
- Interactive canvas object model
- SVG import and export
- JSON scene serialization
- Image filters and animations
- Object grouping and clipping
- On-canvas transform controls
- Browser and Node.js packages
- TypeScript source and typings
Use cases
- In-browser design or annotation tools
- Server-side image composition in Node
- SVG to raster conversion workflows
- Interactive product configurators
- Canvas-based editors and exporters