AppState
The complete application state interface for Excalidraw. This contains all UI state, canvas state, tool state, and user preferences.UI State
Context Menu
Current context menu state including items and position, or null if no context menu is shown
Dialogs and Modals
Currently open dialog. Can be:
null- No dialog open{ name: "imageExport" | "help" | "jsonExport" }{ name: "ttd"; tab: "text-to-diagram" | "mermaid" }{ name: "commandPalette" }{ name: "settings" }{ name: "elementLinkSelector"; sourceElementId: string }
Currently open menu
Currently open popup. Can be:
"canvasBackground""elementBackground""elementStroke""fontFamily""compactTextProperties""compactStrokeStyles""compactOtherProperties""compactArrowProperties"null
Currently open sidebar with optional tab selection
Paste dialog state:
{ shown: false; data: null }{ shown: true; data: Spreadsheet }
Hyperlink popup state
Whether to show the welcome screen
Messages and Notifications
Whether the app is in a loading state
Current error message to display
Toast notification configuration
Canvas State
Viewport
Horizontal scroll offset of the canvas
Vertical scroll offset of the canvas
Zoom level configuration object with normalized value
Canvas width in pixels
Canvas height in pixels
Left offset of the canvas container
Top offset of the canvas container
Whether the user has scrolled outside the canvas bounds
View Settings
Background color of the canvas
Whether view-only mode is enabled (no editing)
Whether zen mode is enabled (minimal UI)
Whether grid is visible
Grid cell size in pixels
Grid step multiplier
Whether object snapping is enabled
Current snap lines for alignment
Offset for origin snapping
Current theme:
"light" or "dark"Frame Rendering
Frame rendering configuration:
enabled: boolean- Whether frames are renderedname: boolean- Whether frame names are shownoutline: boolean- Whether frame outlines are shownclip: boolean- Whether content is clipped to frames
Frame element currently being highlighted
ID of the frame currently being edited
Element State
Selection
Map of selected element IDs
Previously selected element IDs
Map of hovered element IDs
Top-most selected groups (does not include nested groups)
Group being edited when you drill down to its constituent element (e.g., when double-clicking a group element)
Elements to highlight
Element Manipulation
Newly created element being drawn (set on pointer down, updated during pointer move, used on pointer up)
Element currently being resized (set on pointer down when selected and active tool is selection)
Multi-point linear element created by clicking (not dragging). When set, the editor handles linear element creation logic
Selection box element (decoupled from newElement, dragging selection only creates selectionElement)
Whether an element is currently being resized
Whether an element is currently being rotated
Whether selected elements are being dragged
Text Editing
Text element currently being edited (set when creating new text or editing existing text)
Linear Elements
Currently selected linear element with editing state
Binding
Whether element binding is enabled
Element at the start of a binding operation
Suggested binding during arrow creation:
element: NonDeleted<ExcalidrawBindableElement>midPoint?: GlobalPoint
Current binding mode:
"inside" | "orbit" | "skip"Embeddables
Currently active embeddable element:
element: NonDeletedExcalidrawElementstate: "hover" | "active"
Image Cropping
Whether image cropping mode is active
ID of the element being cropped
Locking
The locked element/group that’s active and shows unlock popup
Temporary group IDs for locked multi-selections. Elements are unlocked together and groupId is removed
Tool State
activeTool
ActiveTool & { lastActiveTool: ActiveTool | null; locked: boolean; fromSelection: boolean }
required
Current active tool configuration:
type: ToolTypeor"custom"customType: string | nulllastActiveTool- Previous tool to revert to (applies to eraser and hand)locked- Whether tool is lockedfromSelection- Whether tool is temporarily switched from selection tool
User’s preferred selection tool
Whether pen mode is active
Whether pen input has been detected
Current Drawing Properties
These properties represent the current tool settings that will be applied to newly created elements.Current stroke color for new elements
Current background color for new elements
Current fill style for new elements
Current stroke width for new elements
Current stroke style for new elements
Current roughness for new elements
Current opacity for new elements
Current font family for new text elements
Current font size for new text elements
Current text alignment for new text elements
Current start arrowhead for new arrows
Current end arrowhead for new arrows
Current roundness for new elements
Current arrow type for new arrows
Font family currently being hovered in the font picker
Export Settings
Whether to include background when exporting
Whether to embed scene data when exporting
Whether to export using dark mode colors
Export scale multiplier
Pointer and Input State
Last pointer type used:
"mouse" | "pen" | "touch"Current cursor button state
File State
Name of the current file/scene
File system handle for the current file
Collaboration
Map of active collaborators by socket ID
The user’s socket ID and username who is being followed on the canvas
Set of socket IDs of users following the current user
Statistics
Statistics panel state:
open- Whether stats panel is openpanels- Bitmap of visible panels (use STATS_PANELS bit values)
Chart Settings
Current chart type:
"bar" | "line"Search
Current search matches, or null if no search is active:
focusedId: string | null- Currently focused matchmatches: readonly SearchMatch[]- Array of all matches
UI Preferences
User preference for whether the default sidebar should be docked. Note: This is only a preference and does not reflect actual docked state, as host apps can override this
Whether to cache rendering ignoring zoom level
Supporting Types
Zoom
Normalized zoom value (branded number type)
Collaborator
Collaborator’s pointer position and configuration
Collaborator’s button state
Collaborator’s selected elements
Collaborator’s username
Collaborator’s idle state
Collaborator’s cursor colors
URL of collaborator’s avatar (defaults to username initials if not present)
User ID (used to filter duplicates when rendering avatars)
Collaborator’s socket ID
Whether this is the current user
Whether collaborator is in a call
Whether collaborator is speaking
Whether collaborator is muted
CollaboratorPointer
X coordinate of pointer
Y coordinate of pointer
Tool type
Whether to render cursor and username (useful when only rendering laser trail)
Explicit laser color (defaults to collaborator’s cursor color)
SearchMatch
Element ID of the match
Whether this match is focused
Array of matched line positions
UserToFollow
Socket ID of the user being followed
Username of the user being followed