@mocanvas/editor · interface

TldrawOptions

interface TldrawOptions

The full option bag. Pass a Partial of it; everything unset falls back to defaultTldrawOptions.


Properties · 59

actionShortcutsLocation: TLActionShortcutsLocation

Where the quick actions render.

adjacentShapeMargin: number

Gap left when placing an adjacent shape, duplicating, stacking or packing.

animationMediumMs: number

Duration of a medium-length camera animation: zoom to fit, zoom to selection.

branding?: string | undefined

The application's name, used in accessibility labels ("Canvas for <branding>").

Accepted and used for labelling only. mocanvas paints no watermark and performs no licence check, so there is no vendor branding for this to turn on or off — the label is the whole of it.

camera: TLCameraOptions

The camera's starting policy. Change it later with Editor.setCameraOptions.

cameraMovingTimeoutMs: number

How long after the last camera write the camera counts as settled.

cameraSlideFriction: number

How quickly a flung camera loses speed. 0…1; higher stops sooner.

coarseDragDistanceSquared: number

The same threshold for a coarse pointer, where a still finger still wobbles.

coarseHandleRadius: number

Handle radius for a coarse pointer.

coarseHitTestMargin: number

Hit-test tolerance for a coarse pointer.

coarsePointerWidth: number

Assumed pointer width used to widen the edge-scroll zone for touch.

collaboratorCheckIntervalMs: number

How often collaborator liveness is re-checked.

collaboratorIdleTimeoutMs: number

After this long, a collaborator reads as idle.

collaboratorInactiveTimeoutMs: number

After this long without a presence refresh, a collaborator stops being drawn.

createTextOnCanvasDoubleClick: boolean

Whether double-clicking empty canvas creates a text shape.

debouncedZoom: boolean

Serve a cached zoom level while the camera is moving, on a busy page.

debouncedZoomThreshold: number

Shape count above which debouncedZoom takes effect.

deepLinks?: TLDeepLinkOptions | true | undefined

Mirror the camera into the URL. true for the defaults, or an options object.

defaultSvgPadding: number

Padding around exported SVG content, in page units.

doubleClickDurationMs: number

Longest gap between two clicks that still counts as a double click.

dragDistanceSquared: number

How far a pointer must move before it is a drag, squared.

Squared throughout so drag detection never takes a square root: it runs on every pointer move, and the comparison is exactly as correct either way.

edgeScrollDelay: number

How long the pointer must sit at an edge before scrolling starts.

edgeScrollDistance: number

Width of the band at the viewport edge that triggers scrolling.

edgeScrollEaseDuration: number

How long scrolling takes to reach full speed.

edgeScrollSpeed: number

Screen pixels per frame at full speed, before the user's speed preference.

enableToolbarKeyboardShortcuts: boolean

Whether the number keys select toolbar items.

experimental__onDropOnCanvas?(info: {

Called when something is dropped on the canvas, before the editor's own handling. Return true to claim the drop.

Named experimental__ because its signature is expected to change; it is here because there is no other way to intercept a drop before assets are created for it.

exportProvider: ComponentType<{

A React provider wrapped around exported content.

Export renders shapes outside the editor's own tree, so a custom shape that reads a context — a theme, an i18n provider — renders wrong (or throws) unless that context is re-established here.

flattenImageBoundsExpand: number

How far image bounds are expanded when flattening a selection to one image.

flattenImageBoundsPadding: number

Padding added when flattening a selection to one image.

followChaseViewportSnap: number

How close the viewport must get to a followed collaborator's before it snaps.

gridSteps: readonly TLGridStep[]

The grid's bands, coarsest first. See TLGridStep.

handleRadius: number

Radius of a selection handle's hit area, in screen pixels.

hitTestMargin: number

Extra tolerance around a shape when hit testing, in screen pixels.

laserDelayMs: number

How long the laser trail stays fully visible.

laserFadeoutMs: number

How long the laser trail takes to fade.

longPressDurationMs: number

How long a press must last to become a long press.

maxExportDelayMs: number

How long an export waits for fonts and images before giving up.

maxFilesAtOnce: number

Most files accepted from a single drop or paste.

maxFontsToLoadBeforeRender: number

How many fonts to wait for before the canvas is shown at all.

maxPages: number

Most pages a document may hold. Set to 1 to make the document single-page.

maxShapesPerPage: number

Most shapes one page may hold. Creating past it is refused and reported.

multiClickDurationMs: number

Window in which a further click extends a multi-click.

nonce?: string | undefined

CSP nonce stamped on any style tag the editor injects.

onBeforeCopyToClipboard?(info: {

Called before a selection is written to the clipboard by copy or cut.

Return modified content to transform it, false to cancel the write, or nothing to pass it through untouched.

onBeforePasteFromClipboard?(info: {

Called after a paste has been parsed but before any shape is created. Only fires for a paste — a file drop does not go through the clipboard.

onClipboardPasteRaw?(info: TLClipboardPasteRawInfo): false | void

Called first for a keyboard or menu paste, before the editor tries to parse the clipboard at all. Return false to take the paste over completely.

quickZoomPreservesScreenBounds: boolean

Whether the quick-zoom brush keeps the viewport's scale.

rightClickPanning: boolean

Whether dragging with the right button pans.

selectLockedShapes: boolean

Whether a locked shape can be clicked or brushed into a selection.

snapThreshold: number

Distance, in screen pixels, at which snapping takes hold.

spacebarPanning: boolean

Whether holding space turns the pointer into a pan.

temporaryAssetPreviewLifetimeMs: number

How long a temporary asset preview stays paintable before it expires.

text?: TLTextOptions | undefined

Rich-text configuration. Also accepted as the top-level textOptions.

textShadowLod: number

Zoom below which text shadows stop being drawn.

tooltipDelayMs: number

How long a tooltip waits before appearing.

uiCoarseDragDistanceSquared: number

UI drag threshold for a coarse pointer.

uiDragDistanceSquared: number

Drag threshold for UI elements rather than canvas content.

zoomToFitPadding: number

Padding left around the content by zoomToFit and friends.

Mentioned here

mocanvas is built by Symbio. Free for non-commercial, non-profit and development use; commercial use needs an agreement. Not affiliated with or endorsed by tldraw.