TLAssetShape

See source code

Union type of all shapes that reference assets through an assetId property. Includes image shapes, video shapes, and any other shapes that depend on external assets.

type TLAssetShape = ExtractShapeByProps<{
  assetId: TLAssetId;
}>;

Example

function handleAssetShape(shape: TLAssetShape) {
  const assetId = shape.props.assetId;
  if (!assetId) return;
  const asset = editor.getAsset(assetId);
  // Handle the asset...
}
Prev
TLAssetPartial
Next
TLBinding