Skip to main content

Overview

Excalidraw can be loaded directly in the browser using ES modules and a CDN. This approach is perfect for simple integrations, prototypes, or when you don’t want to use a build system.

Quick Start

Here’s the simplest way to get Excalidraw running:
index.html
Replace @0.18.0 with the latest version from npm.

Project Setup with Build Tool

For better performance and development experience, use a build tool like Vite:
1

Initialize project

2

Create HTML file

Create index.html:
index.html
3

Create entry file

Create index.tsx:
index.tsx
4

Configure Vite

Create vite.config.mts:
vite.config.mts
5

Add scripts to package.json

package.json
6

Run development server

Open http://localhost:3000 in your browser.

Advanced Example with Features

Here’s a comprehensive example showing various Excalidraw features:

Using Initial Data

Load predefined elements when Excalidraw starts:
initialData.tsx
Use it in your app:

Working with Images

Load and display images in your canvas:

File Operations

Load and save Excalidraw files:

TypeScript Setup

Create tsconfig.json for TypeScript support:
tsconfig.json

Production Build

1

Build for production

This creates optimized files in the dist/ directory.
2

Preview production build

3

Deploy

Upload the dist/ directory to your hosting provider (Netlify, Vercel, GitHub Pages, etc.).

CDN Alternatives

Instead of esm.sh, you can use other CDNs:

Live Examples

Explore these working examples:

CodeSandbox

Interactive browser-based example

GitHub Repository

View the complete source code

Next Steps

React Integration

Learn advanced React patterns

Next.js Integration

Integrate with Next.js applications

API Reference

Explore the complete API

Examples

Browse more examples