TldrawEditorProps

Public Interface

Table of Contents
Signature
interface TldrawEditorProps {}

Properties

assetUrls

Public PropertySignature

Asset URLs

Signature
assetUrls?: EditorAssetUrls
References

EditorAssetUrls


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

Partial, TLEditorComponents


config

Public PropertySignature

A configuration defining major customizations to the app, such as custom shapes and new tools

Signature
config?: TldrawEditorConfig
References

TldrawEditorConfig


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

TLInstanceId


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
NameDescription

file

The file to generate an asset from.

id

The id to be assigned to the resulting asset.

Signature
onCreateAssetFromFile?: (file: File) => Promise<TLAsset>
References

File, Promise, TLAsset


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
NameDescription

url

The url that was created.

Signature
onCreateBookmarkFromUrl?: (url: string) => Promise<{
  image: string
  title: string
  description: string
}>
References

Promise


onMount

Public PropertySignature

Called when the app has mounted.

Example
function TldrawEditor() {
  return <Editor onMount={(app) => app.selectAll()} />
}
Parameters
NameDescription

app

The app instance.

Signature
onMount?: (app: App) => void
References

App


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

SyncedStore, TLStore


userId

Public PropertySignature

The id of the current user. If not given, one will be generated.

Signature
userId?: TLUserId
References

TLUserId


Edit this page
Last edited on 11 May 2023
TldrawEditorConfigTLDrawShapeDef