TLAsset

See source code

The set of all assets that are available in the editor.

This is the primary asset type used throughout tldraw. It includes both the built-in default assets and any custom assets registered via TLGlobalAssetPropsMap augmentation.

You can use this type without a type argument to work with any asset, or pass a specific asset type string (e.g., 'image', 'video', 'bookmark') to narrow down to that specific asset type.

type TLAsset<K extends keyof TLIndexedAssets = keyof TLIndexedAssets> =
  TLIndexedAssets[K];

Example

// Register a custom asset type
declare module "@tldraw/tlschema" {
  interface TLGlobalAssetPropsMap {
    file: { name: string; size: number; mimeType: string; src: string | null };
  }
}
Prev
TLArrowShapeKind
Next
TLAssetId