bricks_move_element

Phase 4IntermediateComplexity: 4/10
Move an element to a new parent container

Overview

Move an existing element (and all its children) to a new position within the same page. The element can be moved to a different parent container or reordered within the same parent. The element retains all its settings, classes, and children — only the parent relationship and position change.

This is useful for reorganizing page layout without having to delete and recreate elements. For example, moving a CTA section from the bottom of a page to a different position, or reorganizing cards within a grid.

Key Features

Cross-Container Movement
Move elements between any containers on the page, not just within the same parent.
Position Control
Specify exact position among the new parent's children with position_index, or omit to append at end.
Children Follow
All child elements move with the parent, preserving the entire subtree structure.

When to Use

You need to reorder elements within a container (e.g., move a card to first position)
You want to move an element to a different parent container on the same page
You need to reorganize page structure by relocating elements between sections
You want to move an element to the page root level (parent "0")
Prerequisites
The page, element, and target parent must all exist. Use bricks_get_page_content to find element IDs and understand the current hierarchy. The new parent must be a container-type element or "0" for page root level.

When NOT to Use

You want to copy an element to another page (use bricks_copy_section instead)
You need to reorder root-level sections (use bricks_reorder_sections instead -- more efficient)
You want to duplicate an element and keep the original (use bricks_duplicate_element instead)
You need to move an element to a different content area (delete and recreate instead)

Parameters

5 Total Parameters3 Required2 Optional
page_idnumberREQUIRED
Page ID containing the element.
element_idstringREQUIRED
The 6-char Bricks element ID to move.
new_parent_idstringREQUIRED
New parent element ID. Use "0" to move to page root level.
position_indexnumberoptional
Position among new siblings (0-based). Omit to append at the end of the new parent's children.
content_areastringoptional
Content area where the element currently resides.
Default: content Values: content, header, footer

Code Examples

Move a card to the first position in a grid

Reorder a card within the same parent container by moving it to position 0.

JSON
bricks_move_element({
  page_id: 42,
  element_id: "card03",
  new_parent_id: "grid123",
  position_index: 0
})
Response
{
  "success": true,
  "element_id": "card03",
  "new_parent": "grid123",
  "position": 0
}

Move an element to a different container

Move a button from one container to another container in a different section.

JSON
bricks_move_element({
  page_id: 42,
  element_id: "cta-btn",
  new_parent_id: "hero-container",
  position_index: 2
})
Response
{
  "success": true,
  "element_id": "cta-btn",
  "new_parent": "hero-container",
  "position": 2
}

Common Mistakes

Moving an element to a non-container parent
The new_parent_id must be a container-type element (section, container, block, div) or "0" for root. Content elements like headings or buttons cannot be parents.
Wrong
bricks_move_element({
  element_id: "card01",
  new_parent_id: "heading-id"  // cannot have children!
})
Correct
bricks_move_element({
  element_id: "card01",
  new_parent_id: "container-id"  // can hold children
})
Moving a section to a non-root parent
Section elements should generally be at root level (parent: "0"). Moving a section inside another container can break the page layout.
Wrong
bricks_move_element({
  element_id: "section-id",
  new_parent_id: "container-id"
})
// Section inside a container = broken layout
Correct
bricks_reorder_sections({
  page_id: 42,
  section_order: ["section-2", "section-1", "section-3"]
})
// Use reorder for root sections

Tips & Warnings

Tips & Warnings

For section reordering: Use bricks_reorder_sections instead of moving sections individually. It is more efficient and validates that all sections are accounted for.

Element ID is unchanged: The element keeps its original ID after moving. Any references to this element ID remain valid.

Verify hierarchy first: Use bricks_get_page_content in summary mode to understand the current parent-child relationships before moving elements.

Return Values

FieldTypeDescription
successbooleanWhether the move was successful.
element_idstringThe moved element ID (unchanged).
new_parentstringThe new parent element ID.
positionnumberFinal position index among new siblings.

Related Tools

Technical Details

Tool ID
bricks_move_element
API Endpoint
/bricks-mcp/v1/pages/{page_id}/elements/{element_id}/move
HTTP Method
PUT
Namespace
pages-elements
Source File
pages/elements.ts
Version
1.0
Min Bricks Version
1.9
Requires Auth
Yes

Changelog

v1.0
Initial release with cross-container movement and position control.
20250101