TLStoreProps

See source code
Table of contents

Configuration properties for a tldraw store, defining its behavior and integrations. These props are passed when creating a new store instance.

interface TLStoreProps {}

Example

const storeProps: TLStoreProps = {
  defaultName: "My Drawing",
  assets: myAssetStore,
  onMount: (editor) => {
    console.log("Editor mounted");
    return () => console.log("Editor unmounted");
  },
  collaboration: {
    status: statusSignal,
    mode: modeSignal,
  },
};

const store = new Store({ schema, props: storeProps });

Properties

assets

Asset store implementation for handling file uploads and storage

assets: Required<TLAssetStore>;

collaboration

optional

Optional collaboration configuration for multiplayer features

collaboration?: {
  mode?: null | Signal<"readonly" | "readwrite">;
  status: null | Signal<"offline" | "online">;
};

defaultName

Default name for new documents created in this store

defaultName: string;

users

User store implementation for user resolution and attribution

users: Required<TLUserStore>;

Methods

onMount

Called when an Editor connected to this store is mounted. Can optionally return a cleanup function that will be called when unmounted.

Parameters

NameDescription

editor

unknown;

The editor instance that was mounted

Returns

(() => void) | void;

Optional cleanup function


Prev
TLShapeCrop
Next
TLTextShapeProps