cocos_add_styled_text_block
Add a styled text block with title, subtitle, divider, and body to Cocos Creator UI scenes, using theme colors and proper text wrapping.
Instructions
Title + optional subtitle + optional divider + optional body, stacked.
The single most frequently rebuilt pattern in AI UI code — hoisted
here so you don't compose it from 4-6 add_label calls every time.
Pulls colors from the active UI theme: title uses text preset,
subtitle uses text_dim, divider uses border. Body has
wrap + overflow=RESIZE_HEIGHT so long paragraphs grow the block
instead of clipping.
Divider only materializes when body is present AND show_divider=True
— dividing the top of the block from nothing is visual noise.
align: "left" / "center" / "right" applies to all text pieces.
Returns {block_node_id, title_node_id, subtitle_node_id, divider_node_id, body_node_id}; None for absent pieces.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"scene_path": "<scene_path>",
"parent_node_id": "<parent_node_id>",
"title": "<title>"
},
"name": "cocos_add_styled_text_block"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| scene_path | Yes | ||
| parent_node_id | Yes | ||
| title | Yes | ||
| subtitle | No | ||
| body | No | ||
| width | No | ||
| show_divider | No | ||
| align | No | center |