initialData
{ elements?: ExcalidrawElement[], appState?: AppState }This helps to load Excalidraw with initialData. It must be an object or a promise which resolves to an object containing the below optional fields.
| Name | Type | Description | 
|---|---|---|
| elements | ExcalidrawElement[] | The elementswith whichExcalidrawshould be mounted. | 
| appState | AppState | The AppStatewith whichExcalidrawshould be mounted. | 
| scrollToContent | boolean | This attribute indicates whether to scrollto the nearest element to center onceExcalidrawis mounted. By default, it will not scroll the nearest element to the center. Make sure you passinitialData.appState.scrollXandinitialData.appState.scrollYwhenscrollToContentis false so that scroll positions are retained | 
| libraryItems | LibraryItems | Promise<LibraryItems> | This library items with which Excalidrawshould be mounted. | 
| files | BinaryFiles | The filesadded to the scene. | 
You might want to use this when you want to load excalidraw with some initial elements and app state.
Live Editor
Result
Loading...