TLBaseBinding
See source codeExtends BaseRecord<'binding', TLBindingId>.
Base interface for all binding types in tldraw. Bindings represent relationships between shapes, such as arrows connecting to other shapes or organizational connections.
All bindings extend this base interface with specific type and property definitions. The binding system enables shapes to maintain relationships that persist through transformations, movements, and other operations.
interface TLBaseBinding<Type extends string, Props extends object>
extends BaseRecord<'binding', TLBindingId> {}Example
// Define a custom binding type
interface MyCustomBinding extends TLBaseBinding<'custom', MyCustomProps> {}
interface MyCustomProps {
strength: number
color: string
}
// Create a binding instance
const binding: MyCustomBinding = {
id: 'binding:abc123',
typeName: 'binding',
type: 'custom',
fromId: 'shape:source1',
toId: 'shape:target1',
props: {
strength: 0.8,
color: 'red',
},
meta: {},
}Parameters
| Name | Description |
|---|---|
| String literal type identifying the specific binding type (e.g., 'arrow') |
| Object containing binding-specific properties and configuration |
Properties
fromId
ID of the source shape in this binding relationship
fromId: TLShapeIdid
readonly id: Idmeta
User-defined metadata for extending binding functionality
meta: JsonObjectprops
Binding-specific properties that define behavior and appearance
props: PropstoId
ID of the target shape in this binding relationship
toId: TLShapeIdtype
The specific type of this binding (e.g., 'arrow', 'custom')
type: TypetypeName
readonly typeName: TypeName