TldrawOptions

See source code
Table of contents

Options for configuring tldraw. For defaults, see defaultTldrawOptions.

interface TldrawOptions {}

Example

const options: Partial<TldrawOptions> = {
  maxPages: 3,
  maxShapesPerPage: 1000,
}

function MyTldrawComponent() {
  return <Tldraw options={options} />
}

Properties

actionShortcutsLocation

readonly
readonly actionShortcutsLocation: 'menu' | 'swap' | 'toolbar'

adjacentShapeMargin

readonly
readonly adjacentShapeMargin: number

animationMediumMs

readonly
readonly animationMediumMs: number

branding

readonlyoptional

Branding name of the app, currently only used for adding aria-label for the application.

readonly branding?: string

camera

readonly

Options for the editor's camera. These are the initial camera options. Use Editor.setCameraOptions to update camera options at runtime.

readonly camera: Partial<TLCameraOptions>

cameraMovingTimeoutMs

readonly
readonly cameraMovingTimeoutMs: number

cameraSlideFriction

readonly
readonly cameraSlideFriction: number

coarseDragDistanceSquared

readonly
readonly coarseDragDistanceSquared: number

coarseHandleRadius

readonly
readonly coarseHandleRadius: number

coarsePointerWidth

readonly
readonly coarsePointerWidth: number

collaboratorCheckIntervalMs

readonly
readonly collaboratorCheckIntervalMs: number

collaboratorIdleTimeoutMs

readonly
readonly collaboratorIdleTimeoutMs: number

collaboratorInactiveTimeoutMs

readonly
readonly collaboratorInactiveTimeoutMs: number

createTextOnCanvasDoubleClick

readonly
readonly createTextOnCanvasDoubleClick: boolean

debouncedZoom

readonly

Whether to use debounced zoom level for certain rendering optimizations. When true, editor.getEfficientZoomLevel() returns a cached zoom value while the camera is moving, reducing re-renders. When false, it always returns the current zoom level.

readonly debouncedZoom: boolean

debouncedZoomThreshold

readonly

The number of shapes that must be on the page for the debounced zoom level to be used. Defaults to 500 shapes.

readonly debouncedZoomThreshold: number

readonly

Options for syncing the editor's camera state with the URL. Set to true to enable with default options, or pass an options object to customize behavior.

readonly deepLinks: TLDeepLinkOptions | true | undefined

Example

// Enable with defaults
<Tldraw options={{ deepLinks: true }} />

// Enable with custom options
<Tldraw options={{ deepLinks: { param: 'd', debounceMs: 500 } }} />

defaultSvgPadding

readonly
readonly defaultSvgPadding: number

doubleClickDurationMs

readonly
readonly doubleClickDurationMs: number

dragDistanceSquared

readonly
readonly dragDistanceSquared: number

edgeScrollDelay

readonly
readonly edgeScrollDelay: number

edgeScrollDistance

readonly
readonly edgeScrollDistance: number

edgeScrollEaseDuration

readonly
readonly edgeScrollEaseDuration: number

edgeScrollSpeed

readonly
readonly edgeScrollSpeed: number

enableToolbarKeyboardShortcuts

readonly

By default, the toolbar items are accessible via number shortcuts according to their order. To disable this, set this option to false.

readonly enableToolbarKeyboardShortcuts: boolean

exportProvider

readonly

The react provider to use when exporting an image. This is useful if your shapes depend on external context providers. By default, this is React.Fragment.

readonly exportProvider: ComponentType<{
  children: React.ReactNode
}>

flattenImageBoundsExpand

readonly
readonly flattenImageBoundsExpand: number

flattenImageBoundsPadding

readonly
readonly flattenImageBoundsPadding: number

followChaseViewportSnap

readonly
readonly followChaseViewportSnap: number

gridSteps

readonly
readonly gridSteps: readonly {
  readonly mid: number
  readonly min: number
  readonly step: number
}[]

handleRadius

readonly
readonly handleRadius: number

hitTestMargin

readonly
readonly hitTestMargin: number

laserDelayMs

readonly
readonly laserDelayMs: number

laserFadeoutMs

readonly

How long (in milliseconds) to fade all laser scribbles after the session ends. The total points across all scribbles will be removed proportionally over this duration. Defaults to 500ms (0.5 seconds).

readonly laserFadeoutMs: number

longPressDurationMs

readonly
readonly longPressDurationMs: number

maxExportDelayMs

readonly
readonly maxExportDelayMs: number

maxFilesAtOnce

readonly
readonly maxFilesAtOnce: number

maxFontsToLoadBeforeRender

readonly

The maximum number of fonts that will be loaded while blocking the main rendering of the canvas. If there are more than this number of fonts needed, we'll just show the canvas right away and let the fonts load in in the background.

readonly maxFontsToLoadBeforeRender: number

maxPages

readonly
readonly maxPages: number

maxShapesPerPage

readonly
readonly maxShapesPerPage: number

multiClickDurationMs

readonly
readonly multiClickDurationMs: number

nonce

readonly

If you have a CSP policy that blocks inline styles, you can use this prop to provide a nonce to use in the editor's styles.

readonly nonce: string | undefined

quickZoomPreservesScreenBounds

readonly

Whether the quick-zoom brush preserves its screen-pixel size when the user zooms the overview. When true, zooming in shrinks the target viewport (higher return zoom); zooming out expands it. When false, the brush keeps the original viewport's page dimensions regardless of overview zoom changes.

readonly quickZoomPreservesScreenBounds: boolean

snapThreshold

readonly

The distance (in screen pixels) at which shapes snap to guides and other shapes.

readonly snapThreshold: number

spacebarPanning

readonly

Whether to allow spacebar panning. When true, the spacebar will pan the camera when held down. When false, the spacebar will not pan the camera.

readonly spacebarPanning: boolean

temporaryAssetPreviewLifetimeMs

readonly

How long should previews created by Editor.createTemporaryAssetPreview last before they expire? Defaults to 3 minutes.

readonly temporaryAssetPreviewLifetimeMs: number

text

readonly

Options for the editor's text rendering. These include TipTap configuration and font handling. These are the initial text options and cannot be changed at runtime.

readonly text: TLTextOptions

textShadowLod

readonly
readonly textShadowLod: number

tooltipDelayMs

readonly
readonly tooltipDelayMs: number

uiCoarseDragDistanceSquared

readonly
readonly uiCoarseDragDistanceSquared: number

uiDragDistanceSquared

readonly
readonly uiDragDistanceSquared: number

zoomToFitPadding

readonly

The default padding (in pixels) used when zooming to fit content in the viewport. This affects methods like zoomToFit(), zoomToSelection(), and zoomToBounds(). The actual padding used is the minimum of this value and 28% of the viewport width. Defaults to 128 pixels.

readonly zoomToFitPadding: number

Methods

experimental__onDropOnCanvas

optional

Called when content is dropped on the canvas. Provides the page position where the drop occurred and the underlying drag event object. Return true to prevent default drop handling (files, URLs, etc.)

Parameters

NameDescription

options

{
  event: React.DragEvent<Element>
  point: VecLike
}

Returns

boolean

Prev
TldrawEditorWithStoreProps
Next
TLDropShapesOverInfo