Exapedia / Tools / React canvas libraries React canvas libraries Updated Nov 2026
React canvas libraries draw graphics on an HTML canvas element through React components. A renderer keeps a scene graph of shapes or objects and redraws the canvas when their props change. These libraries let drawing tools, signature pads, and design editors render interactive graphics in the browser.
Popularity @react-three/fiber React Konva React Native Skia react-signature-canvas Excalidraw tldraw react-zdog @pixi/react FAQ Libraries and code examples Renders Three.js scenes through React components.
Downloads / mo 35.7M
Stars 33.8K
Last release 9.8.2
License MIT Strengths Builds interactive 3D scenes . Compose reusable scene components and animate them in the render loop. Exposes renderer and scene state . Read the active renderer, scene, and camera through useThree. Limitations Hooks require Canvas context . Call useFrame and useThree inside the Canvas component tree. $ npm install three @react-three/fiber Copy
import React from 'react'
import { Canvas } from '@react-three/fiber'
const App = () => (
<Canvas>
<pointLight position={[10, 10, 10]} />
<mesh>
<sphereGeometry />
<meshStandardMaterial color="hotpink" />
</mesh>
</Canvas>
)
@react-three/fiber examples From open-source projects on GitHub export function useCubeCamera({ resolution = 256, near = 0.1, far = 1000, envMap, fog }: CubeCameraOptions = {}) {
const gl = useThree(({ gl }) => gl)
const scene = useThree(({ scene }) => scene)
const fbo = useMemo(() => {
const fbo = new WebGLCubeRenderTarget(resolution)
fbo.texture.type = HalfFloatType
return fbo
}, [resolution])
useEffect(() => {
return () => {
fbo.dispose()
}
}, [fbo])
const camera = useMemo(() => new THREE.CubeCamera(near, far, fbo), [near, far, fbo])
let originalFog
let originalBackground
const update = React.useCallback(() => {
originalFog = scene.fog
originalBackground = scene.background
scene.background = envMap || originalBackground
scene.fog = fog || originalFog
camera.update(gl, scene)
scene.fog = originalFog
scene.background = originalBackground
}, [gl, scene, camera])
return {
fbo,
camera,
update,
}
}
Show full example Provides declarative React components for a two-dimensional canvas scene graph.
Downloads / mo 10.9M
Stars 6.4K
Last release 19.3.2
License MIT Strengths Builds interactive scene graphs . Compose shapes, images, and groups as React components. Exports composed canvas images . Use a node ref to export the rendered drawing as PNG. Limitations Manual changes can outlive renders . Enable its strict mode when supplied props must be restored on every update. $ npm install react-konva konva Copy
import {useState} from 'react';
import {Stage, Layer, Rect} from 'react-konva';
export default function App() {
const [color, setColor] = useState('#00a8e8');
return (
<Stage width={600} height={400}>
<Layer>
<Rect
x={50} y={50} width={120} height={80}
fill={color} draggable
onClick={() => setColor(color === '#00a8e8' ? '#ff7a00' : '#00a8e8')}
/>
</Layer>
</Stage>
);
}
React Konva examples From open-source projects on GitHub (e: Konva.KonvaEventObject<MouseEvent>) => {
// Handle pan move
if (isPanning) {
handlePanMove(e);
return;
}
if (!isDrawing || !drawStart || !tempAnnotation) return;
const stage = e.target.getStage();
if (!stage) return;
const pos = stage.getPointerPosition();
if (!pos) return;
// Convert to unscaled coordinates (accounting for stage position including pan offset and centering)
const stageX = stage.x();
const stageY = stage.y();
const x = (pos.x - stageX) / scale;
const y = (pos.y - stageY) / scale;
const width = x - drawStart.x;
const height = y - drawStart.y;
if (tempAnnotation.type === 'arrow' || tempAnnotation.type === 'line') {
setTempAnnotation({
...tempAnnotation,
points: [0, 0, width, height],
width: width,
height: height,
});
} else {
// For rectangle and ellipse, handle negative dimensions
const newX = width < 0 ? x : drawStart.x;
const newY = height < 0 ? y : drawStart.y;
setTempAnnotation({
...tempAnnotation,
x: newX,
y: newY,
width: Math.abs(width),
height: Math.abs(height),
});
}
}
Show full example Renders React Native graphics with Skia.
Downloads / mo 8.9M
Stars 8.8K
Last release 2.14.0
License MIT $ npm install @shopify/react-native-skia Copy
import { WithSkiaWeb } from "@shopify/react-native-skia/lib/module/web";
import { version } from "canvaskit-wasm/package.json";
export default function App() {
return (
<WithSkiaWeb
opts={{ locateFile: (file) => `https://cdn.jsdelivr.net/npm/canvaskit-wasm@${version}/bin/full/${file}` }}
getComponent={() => import("./MySkiaComponent")}
/>
);
}
Wraps signature_pad with a React canvas component.
Downloads / mo 6.4M
Stars 653
Last release 1.1.0-alpha.2
License Apache-2.0 Strengths Captures and restores signature strokes . Read point groups with toData and restore them with fromData. Exports trimmed signature images . Trim surrounding whitespace before obtaining a signature image. Limitations Resize clears signatures by default . Set clearOnResize=false when resizing should preserve the current signature. $ npm i -S react-signature-canvas Copy
import React from 'react'
import { createRoot } from 'react-dom/client'
import SignatureCanvas from 'react-signature-canvas'
createRoot(
document.getElementById('my-react-container')
).render(
<SignatureCanvas penColor='green'
canvasProps={{width: 500, height: 200, className: 'sigCanvas'}} />,
)
react-signature-canvas examples From open-source projects on GitHub export default function SignatureDialog(props: any) {
const [currentTab, setCurrentTab] = useState(tabs[0]);
const [typedSignature, setTypedSignature] = useState("");
const [signatureEmpty, setSignatureEmpty] = useState(true);
// This is a workaround to prevent the canvas from being rendered when the dialog is closed
// we also need the debounce to avoid rendering while transitions are occuring.
const showCanvas = useDebouncedValue<boolean>(props.open, 1);
let signCanvasRef: any | undefined;
useEffect(() => {
setTypedSignature(localStorage.getItem("typedSignature") || "");
}, []);
return (
<>
<Transition.Root show={props.open} as={Fragment}>
<Dialog
as="div"
className="relative z-10"
onClose={() => {
props.setOpen(false);
setCurrent(tabs[0]);
}}>
<Transition.Child
as={Fragment}
enter="ease-out duration-300"
enterFrom="opacity-0"
enterTo="opacity-100"
leave="ease-in duration-200"
leaveFrom="opacity-100"
leaveTo="opacity-0">
<div className="fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity" />
</Transition.Child>
<div className="fixed inset-0 z-10 overflow-y-auto">
<div className="flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0">
<Transition.Child
as={Fragment}
enter="ease-out duration-300"
enterFrom="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
enterTo="opacity-100 translate-y-0 sm:scale-100"
leave="ease-in duration-200"
leaveFrom="opacity-100 translate-y-0 sm:scale-100"
leaveTo="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95">
<Dialog.Panel className="relative min-h-[350px] transform overflow-hidden rounded-lg bg-white px-4 pt-5 pb-4 text-left shadow-xl transition-all sm:my-8 sm:w-full sm:max-w-sm sm:p-6">
<div className="">
<div className="mb-3 border-b border-gray-200">
<nav className="-mb-px flex space-x-8" aria-label="Tabs">
{tabs.map((tab) => (
<a
key={tab.name}
onClick={() => {
setCurrent(tab);
}}
className={classNames(
tab.current
? "border-neon text-neon"
: "border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700",
"group inline-flex cursor-pointer items-center border-b-2 py-4 px-1 text-sm font-medium"
)}
aria-current={tab.current ? "page" : undefined}>
<tab.icon
className={classNames(
tab.current
? "text-neon"
: "text-gray-400 group-hover:text-gray-500",
"-ml-0.5 mr-2 h-5 w-5"
)}
aria-hidden="true"
/>
<span>{tab.name}</span>
</a>
))}
</nav>
</div>
{isCurrentTab("Type") ? (
<div>
<div className="my-8 mb-3 border-b border-gray-300">
<input
value={typedSignature}
onChange={(e) => {
setTypedSignature(e.target.value);
}}
className={classNames(
typedSignature ? "font-qwigley text-4xl" : "",
"focus:border-neon focus:ring-neon mt-14 block h-10 w-full text-center align-bottom text-2xl leading-none"
)}
placeholder="Kindly type your name"
/>
</div>
<div className="float-right">
<Button
color="secondary"
onClick={() => {
props.onClose();
props.setOpen(false);
setCurrent(tabs[0]);
}}>
Cancel
</Button>
<Button
className="ml-3"
disabled={!typedSignature}
onClick={() => {
localStorage.setItem("typedSignature", typedSignature);
props.onClose({
type: "type",
typedSignature: typedSignature,
});
}}>
Sign
</Button>
</div>
</div>
) : (
""
)}
{isCurrentTab("Draw") ? (
<div className="" key={props.open ? "closed" : "open"}>
{showCanvas && (
<SignatureCanvas
ref={(ref) => {
signCanvasRef = ref;
}}
canvasProps={{
className: "sigCanvas border-b b-2 border-slate w-full h-full mb-3",
}}
clearOnResize={true}
onEnd={() => {
setSignatureEmpty(signCanvasRef?.isEmpty());
}}
/>
)}
<IconButton
className="float-left block"
icon={TrashIcon}
onClick={() => {
signCanvasRef?.clear();
setSignatureEmpty(signCanvasRef?.isEmpty());
}}></IconButton>
<div className="float-right mt-10">
<Button
color="secondary"
onClick={() => {
props.onClose();
props.setOpen(false);
setCurrent(tabs[0]);
}}>
Cancel
</Button>
<Button
className="ml-3"
onClick={() => {
props.onClose({
type: "draw",
signatureImage: signCanvasRef.toDataURL("image/png"),
});
}}
disabled={signatureEmpty}>
Sign
</Button>
</div>
</div>
) : (
""
)}
</div>
</Dialog.Panel>
</Transition.Child>
</div>
</div>
</Dialog>
</Transition.Root>
</>
);
function isCurrentTab(tabName: string): boolean {
return currentTab.name === tabName;
}
function setCurrent(t: any) {
tabs.forEach((tab) => {
tab.current = tab.name === t.name;
});
setCurrentTab(t);
}
}
Show full example Provides Excalidraw as a React component.
Downloads / mo 5.2M
Stars 135.9K
Last release 0.18.1
License MIT $ npm install react react-dom @excalidraw/excalidraw Copy
import { Excalidraw } from "@excalidraw/excalidraw";
import "@excalidraw/excalidraw/index.css";
export default function App() {
return (
<div style={{ height: "100vh" }}>
<Excalidraw />
</div>
);
}
Provides a small drawing editor.
Downloads / mo 2.8M
Stars 51.5K
Last release 5.6.1
License tldraw license (production license required) $ npm install tldraw Copy
import { Tldraw } from 'tldraw'
import 'tldraw/tldraw.css'
export default function App() {
return (
<div style={{ position: 'fixed', inset: 0 }}>
<Tldraw />
</div>
)
}
Renders zdog scenes through a React Fiber renderer.
Downloads / mo 1.6M
Stars 454
Last release 1.2.2
License MIT $ npm install zdog react-zdog Copy
import { Illustration, Shape } from "react-zdog";
export default function App() {
return (
<Illustration zoom={8}>
<Shape stroke={20} color="lightblue" rotate={{ x: Math.PI }} />
</Illustration>
);
}
Writes PixiJS applications in a declarative React style.
Downloads / mo 570.9K
Stars 2.9K
Last release 8.0.5
License MIT $ npm install pixi.js@^8.2.6 @pixi/react Copy
import {Application, extend} from '@pixi/react'
import {Graphics} from 'pixi.js'
import {useCallback} from 'react'
extend({Graphics})
const MyComponent = () => {
const draw = useCallback(graphics => {
graphics.clear()
graphics.setFillStyle({color: 'red'})
graphics.rect(0, 0, 100, 100)
graphics.fill()
}, [])
return <Application><pixiGraphics draw={draw} /></Application>
}
For coding agents
Found your canvas library? Help your agent use it. Connect Exa so your coding agent can find the library’s documentation, check its API, and look up implementations while you build.
Claude Code Cursor Codex VS Code Devin Devin Desktop Gemini CLI OpenCode
Run in your terminal
claude plugin install exa@claude-plugins-official Copy Add to ~/.cursor/mcp.json
{
"mcpServers": {
"exa": {
"url": "https://mcp.exa.ai/mcp"
}
}
} Copy Open in your browser, then install the Exa plugin
https://chatgpt.com/plugins/exa Copy Add to .vscode/mcp.json
{
"servers": {
"exa": {
"type": "http",
"url": "https://mcp.exa.ai/mcp"
}
}
} Copy In Devin, open Customize, then MCPs, and add a custom HTTP server with this URL
https://mcp.exa.ai/mcp Copy Add to ~/.config/devin/mcp_config.json
{
"mcpServers": {
"exa": {
"serverUrl": "https://mcp.exa.ai/mcp"
}
}
} Copy Add to ~/.gemini/settings.json
{
"mcpServers": {
"exa": {
"httpUrl": "https://mcp.exa.ai/mcp"
}
}
} Copy Add to opencode.json
{
"mcp": {
"exa": {
"type": "remote",
"url": "https://mcp.exa.ai/mcp"
}
}
} Copy