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

Let’s talk

React API Reference

AttributeInstance

This interface describes the properties of a builder entity's attribute instance, which is usually is part of the attributes property of a builder entity instance.

Reference

AttributeInstance<TAttribute>

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

import { labelAttribute } from "./label-attribute";

type LabelAttributeInstance = AttributeInstance<typeof labelAttribute>;

Properties

The AttributeInstance interfaces has the following properties:

PropTypeDescription
typestringThe type identifier of the attribute. Corresponds to the key of the attribute definition in the entity definition.
getValuefunctionReturns the current value of the attribute.
setValuefunctionSets the value of the attribute.
getErrorfunctionReturns the current validation error associated with the attribute, if any.
validatefunctionValidates the attribute’s value. Returns a promise that resolves with the validation result.
setErrorfunctionSets a validation error for the attribute.
subscribeToValuefunctionSubscribes to changes in the attribute's value. Optionally accepts a comparator. Returns an unsubscribe function.
subscribeToErrorfunctionSubscribes to changes in the attribute's error state. Optionally accepts a comparator. Returns an unsubscribe function.
Previous
BuilderEntityInstance

Canary Branch