TLBaseAsset
See source codeExtends BaseRecord<'asset', TLAssetId>
.
Base interface for all asset records in tldraw. Assets represent external resources like images, videos, or bookmarks that shapes can reference. This interface extends the base record system with asset-specific typing.
interface TLBaseAsset<Type extends string, Props>
extends BaseRecord<'asset', TLAssetId> {}
Example
// Define a custom asset type
interface MyCustomAsset
extends TLBaseAsset<'custom', { url: string; title: string }> {}
const customAsset: MyCustomAsset = {
id: 'asset:custom123',
typeName: 'asset',
type: 'custom',
props: {
url: 'https://example.com',
title: 'My Custom Asset',
},
meta: {},
}
Parameters
Name | Description |
---|---|
| The specific asset type identifier (e.g., 'image', 'video', 'bookmark') |
| The properties object specific to this asset type |
Properties
id
readonly
from BaseRecord
readonly id: Id
meta
User-defined metadata that can be attached to this asset
meta: JsonObject
props
Type-specific properties for this asset
props: Props
type
The specific type of this asset (e.g., 'image', 'video', 'bookmark')
type: Type
typeName
readonly
from BaseRecord
readonly typeName: TypeName
Prev
TLAssetStoreNext
TLBaseBinding