We are Coltor Apps ― a software development agency behind this OSS. Need a reliable tech partner?

Let’s talk

React API Reference

BuilderEntityInstance

This interface describes the properties of a builder entity instance, which is usually injected as a prop into builder entities components.

Reference

BuilderEntityInstance<TEntity>

import { type BuilderEntityInstance } from "@coltorapps/builder-react";

import { textFieldEntity } from "./text-field-entity";

type BuilderTextFieldInstance = BuilderEntityInstance<typeof textFieldEntity>;

Properties

The BuilderEntityInstance interfaces has the following properties:

PropTypeDescription
idstringThe unique identifier of the entity.
typestringThe type identifier of the entity. Corresponds to the key of the entity definition in the builder definition.
childrenarray optionalOptional array of child entity IDs.
parentIdstring optionalOptional ID of the parent entity. If undefined, the entity is considered a root-level entity.
attributesobjectA record of all attribute instances for the entity, keyed by attribute name.
metadataunknownYour custom metadata associated with the entity.
setParentfunctionSets the parent of the entity by parentId. Optionally accepts an index to specify the position among siblings.
unsetParentfunctionUnsets an entity's parent and moves it to the root. Optionally accepts an index to target a specific child slot.
setIndexfunctionSets the index of the entity among its siblings.
setAttributefunctionUpdates a single attribute value on the entity by name.
deletefunctionDeletes the entity from the builder store.
clonefunctionClones the entity, creating a new one with the same attributes and children.
validateAttributefunctionValidates a specific attribute and returns its validated value.
validateAttributesfunctionValidates all attributes of the entity.
resetAttributeErrorfunctionClears the validation error for a specific attribute.
resetAttributesErrorsfunctionClears all attribute validation errors for the entity.
setAttributesErrorsfunctionSets multiple attribute validation errors at once for the entity.
setAttributeErrorfunctionSets a validation error for a specific attribute.
getAttributesValuesfunctionReturns the current values of all attributes for the entity.
getAttributesErrorsfunctionReturns the current validation errors for the entity's attributes.
subscribeToAttributesValuesfunctionSubscribes to attribute value changes. Returns an unsubscribe function. Optionally accepts a comparator for change detection.
subscribeToAttributesErrorsfunctionSubscribes to attribute error changes. Returns an unsubscribe function. Optionally accepts a comparator for change detection.
Previous
BuilderEntityComponentProps

Canary Branch