bricks_update_component
Overview
Updates an existing Bricks Component. You can modify the label, category, element tree, and/or properties. When updating elements, the entire element tree is replaced — partial updates to individual elements within a component are not supported.
This tool is essential for iterating on component designs during development. If you need to add a new property, change the internal structure, or fix styling on a component, use this tool rather than deleting and recreating it, which would break existing instances.
Key Features
When to Use
When adding or modifying configurable properties on an existing component
When renaming or recategorizing a component for better organization
When fixing styling or layout issues discovered during page building
After creating a component, if you realize it needs additional properties
If updating elements, the new element tree must include all ref names used by existing properties
Existing instances on pages will use the updated structure
When NOT to Use
When you want to delete a component entirely — use bricks_delete_component
For minor tweaks to individual instances — update the instance properties directly
Parameters
Warning: Undefined array key "param_enum_values" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 28
component_idstringREQUIREDWarning: Undefined array key "param_enum_values" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 28
labelstringoptionalWarning: Undefined array key "param_enum_values" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 28
categorystringoptionalWarning: Undefined array key "param_enum_values" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 28
elementsobjectoptionalWarning: Undefined array key "param_enum_values" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 28
propertiesarrayoptionalCode Examples
Add a new property to an existing component
Adds a "Link" property to a card component so each instance can have a different URL.
bricks_update_component({
component_id: "abc123",
properties: [
{ label: "Image", connections: { "card-image": ["image"] } },
{ label: "Icon", connections: { "card-icon": ["icon"] } },
{ label: "Title", connections: { "card-title": ["text"] } },
{ label: "Description", connections: { "card-desc": ["text"] } },
{ label: "Link", connections: { "card-root": ["link"] } }
]
}){
"success": true,
"data": {
"id": "abc123",
"label": "Category Card",
"properties": [...]
}
}Common Mistakes
// Removes the element with ref "card-title" but properties still reference it
bricks_update_component({ component_id: "abc123", elements: { type: "div", children: [...] } })// New tree still includes ref "card-title"
bricks_update_component({ component_id: "abc123", elements: { type: "div", children: [
{ type: "heading", ref: "card-title", settings: { "tag": "h3" } }, ...
] } })Tips & Warnings
Element replacement is total: When you provide elements, the entire tree is replaced. There is no partial element update within a component — provide the complete tree.
Property label matching: Existing instances store property values keyed by label. If you rename a property label, instances will lose that value. Keep labels stable once components are in use.
Check usage first: Before making breaking changes, run bricks_get_component_usage to see how many instances exist across the site.