TldrawEditorProps
Public Interface
Table of Contents
Signature
interface TldrawEditorProps {}
Properties
assetUrls
Public PropertySignature
Asset URLs
Signature
assetUrls?: EditorAssetUrls
References
autoFocus
Public PropertySignature
Whether to automatically focus the editor when it mounts.
Signature
autoFocus?: boolean
children
Public PropertySignature
Signature
children?: any
components
Public PropertySignature
Overrides for the tldraw components
Signature
components?: Partial<TLEditorComponents>
References
config
Public PropertySignature
A configuration defining major customizations to the app, such as custom shapes and new tools
Signature
config?: TldrawEditorConfig
References
instanceId
Public PropertySignature
The id of the app instance (e.g. a browser tab if the app will have only one tldraw app per tab). If not given, one will be generated.
Signature
instanceId?: TLInstanceId
References
isDarkMode
Public PropertySignature
Whether to display the dark mode.
Signature
isDarkMode?: boolean
onCreateAssetFromFile
Public PropertySignature
Called when the app generates a new asset from a file, such as when an image is dropped into the canvas.
Example
const app = new App({
onCreateAssetFromFile: (file) => uploadFileAndCreateAsset(file),
})
Parameters
Name | Description |
---|---|
| The file to generate an asset from. |
| The id to be assigned to the resulting asset. |
Signature
onCreateAssetFromFile?: (file: File) => Promise<TLAsset>
References
onCreateBookmarkFromUrl
Public PropertySignature
Called when a URL is converted to a bookmark. This callback should return the metadata for the bookmark.
Example
app.onCreateBookmarkFromUrl(url, id)
Parameters
Name | Description |
---|---|
| The url that was created. |
Signature
onCreateBookmarkFromUrl?: (url: string) => Promise<{
image: string
title: string
description: string
}>
References
onMount
Public PropertySignature
Called when the app has mounted.
Example
function TldrawEditor() {
return <Editor onMount={(app) => app.selectAll()} />
}
Parameters
Name | Description |
---|---|
| The app instance. |
Signature
onMount?: (app: App) => void
References
store
Public PropertySignature
The Store instance to use for keeping the app's data. This may be prepopulated, e.g. by loading from a server or database.
Signature
store?: SyncedStore | TLStore
References
userId
Public PropertySignature
The id of the current user. If not given, one will be generated.
Signature
userId?: TLUserId