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: TLShapeId
id
readonly id: Id
meta
User-defined metadata for extending binding functionality
meta: JsonObject
props
Binding-specific properties that define behavior and appearance
props: Props
toId
ID of the target shape in this binding relationship
toId: TLShapeId
type
The specific type of this binding (e.g., 'arrow', 'custom')
type: Type
typeName
readonly typeName: TypeName