add_component_property
Add a BOOLEAN, TEXT, or INSTANCE_SWAP property to a component. Provide componentId, name, type, and defaultValue; returns propertyId for binding and editing.
Instructions
Declare a component property on a component (or its variant set): BOOLEAN (show/hide a layer), TEXT (editable text), or INSTANCE_SWAP (swappable nested instance). The property starts inert — attach it to a layer with bind_component_property (BOOLEAN→visible, TEXT→characters, INSTANCE_SWAP→mainComponent) for it to do anything. defaultValue must match the type (boolean / string / a component key string); preferredValues (INSTANCE_SWAP only) pre-populates the swap menu. VARIANT properties come from combine_as_variants, not here. Returns { ok, componentId, propertyId, name } — pass propertyId to bind / edit / delete / set_instance_properties.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Property name, e.g. "Show Icon" | |
| type | Yes | Property type | |
| componentId | Yes | Component or component-set id (a variant resolves to its set) | |
| defaultValue | Yes | Default: boolean (BOOLEAN), string (TEXT), or a component key (INSTANCE_SWAP) | |
| preferredValues | No | INSTANCE_SWAP only: components/sets offered in the swap menu |