TLDocument
See source codeExtends BaseRecord<'document', RecordId<TLDocument>>.
Document record containing global settings and metadata for a tldraw document. There is exactly one document record per tldraw instance with a fixed ID.
interface TLDocument extends BaseRecord<'document', RecordId<TLDocument>> {}Example
const document: TLDocument = {
id: 'document:document',
typeName: 'document',
gridSize: 20, // Grid snap size in pixels
name: 'My Drawing', // Document name
meta: {
createdAt: Date.now(),
author: 'user123',
version: '1.0.0',
},
}
// Update document settings
editor.updateDocumentSettings({
name: 'Updated Drawing',
gridSize: 25,
})Properties
gridSize
Grid snap size in pixels. Used for shape positioning and alignment
gridSize: numberid
readonly
from BaseRecord
readonly id: Idmeta
User-defined metadata for the document
meta: JsonObjectname
Human-readable name of the document
name: stringtypeName
readonly
from BaseRecord
readonly typeName: TypeNamePrev
TLDefaultColorThemeColorNext
TLDrawShapeProps