createBindingId
Creates a new TLBindingId with proper formatting. Generates a unique ID if none is provided, or formats a provided ID correctly.
function createBindingId(id?: string): TLBindingId;Example
// Create with auto-generated ID
const bindingId1 = createBindingId(); // 'binding:abc123'
// Create with custom ID
const bindingId2 = createBindingId("myCustomBinding"); // 'binding:myCustomBinding'
// Use in binding creation
const binding: TLBinding = {
id: createBindingId(),
type: "arrow",
fromId: "shape:arrow1",
toId: "shape:rectangle1",
// ... other properties
};Parameters
| Name | Description |
|---|---|
| Optional custom ID suffix. If not provided, a unique ID is generated |
Returns
A properly formatted binding ID
Prev
createAssetValidatorNext
createBindingPropsMigrationIds