Documentation Index
Fetch the complete documentation index at: https://mintlify.com/excalidraw/excalidraw/llms.txt
Use this file to discover all available pages before exploring further.
Excalidraw Component
TheExcalidraw component is the main React component that renders the complete Excalidraw editor. It provides a fully-featured, customizable whiteboard experience that can be embedded in any React application.
Basic Usage
Props
Core Props
Callback fired when elements, appState, or files change.
Initial scene data to load. Can be an object or a function that returns initial data (sync or async).
Callback to receive the Excalidraw API instance for imperative actions.
Appearance Props
Sets the editor theme. When not provided, users can toggle between themes.
When true, renders the editor in view-only mode with no editing capabilities.
When true, hides the UI chrome for a distraction-free experience.
When true, shows a grid on the canvas.
Name of the document/scene, used as the default filename when exporting.
Behavior Props
When true, automatically focuses the canvas on mount.
When true, detects scrolling outside the canvas to prevent accidental scrolls.
When true, keyboard shortcuts work globally instead of only when canvas is focused.
Controls whether to render scrollbars on the canvas.
Collaboration Props
Indicates whether the editor is in collaboration mode.
Callback fired when the user’s pointer position changes, useful for real-time collaboration.
Event Callbacks
Called on every state increment (ephemeral or durable).
Called when paste is triggered. Return true to prevent default paste behavior.
Called when elements are duplicated. Return modified elements or void.
Called on pointer down events.
Called on pointer up events.
Called when the canvas scroll position or zoom changes.
Called when following a collaborator.
Library & File Management
Called when the library items change.
Custom function to generate IDs for uploaded files.
URL to return to after opening the public library.
Link Handling
Called when a link is clicked.
Generate a custom link for selected element(s).
Embedding
Controls which URLs can be embedded. Can be a boolean, array of allowed domains, regex pattern(s), or validation function.
Custom renderer for embeddable elements.
Custom UI Rendering
Render custom UI in the top-left corner.
Render custom UI in the top-right corner.
Render custom statistics panel content.
UI Configuration
Configure which UI elements are displayed and their behavior.
Advanced Props
Language code for internationalization. Supported languages include en, es, fr, de, pt, ru, zh, ja, and more.
When false, disables AI features like text-to-diagram.
When true, shows deprecated font options.
Custom components to render inside Excalidraw, such as MainMenu, WelcomeScreen, Footer, or Sidebar.
Excalidraw API
The imperative API is provided via theexcalidrawAPI prop callback:
API Methods
updateScene(sceneData)- Update elements and app stateresetScene(opts)- Clear the canvas and reset stategetSceneElements()- Get current non-deleted elementsgetSceneElementsIncludingDeleted()- Get all elementsgetAppState()- Get current app stategetFiles()- Get binary filesrefresh()- Force re-rendersetToast(message)- Show toast notificationsetActiveTool(tool)- Change active toolsetCursor(cursor)- Set custom cursorresetCursor()- Reset to default cursortoggleSidebar(name)- Toggle sidebar visibilityscrollToContent(elements, opts)- Scroll to view specific elementsaddFiles(files)- Add binary filesupdateLibrary(libraryItems)- Update library items
API Event Listeners
onChange(callback)- Listen to changes (elements, appState, files)onIncrement(callback)- Listen to state incrementsonPointerDown(callback)- Listen to pointer down eventsonPointerUp(callback)- Listen to pointer up eventsonScrollChange(callback)- Listen to scroll/zoom changesonUserFollow(callback)- Listen to user follow events
Complete Example
See Also
- MainMenu - Customize the main menu
- Sidebar - Add custom sidebars
- WelcomeScreen - Customize the welcome screen
- Footer - Customize the footer
- Button - Use Excalidraw button components