cocos_add_label
Add text labels to Cocos Creator game scenes with customizable styling, overflow handling, and design token presets for consistent UI theming.
Instructions
Attach cc.Label. overflow: 0=NONE 1=CLAMP 2=SHRINK 3=RESIZE_HEIGHT. cache_mode: 0=NONE 1=BITMAP 2=CHAR. CLAMP truncates, SHRINK auto-shrinks font.
Design-token presets (override the equivalent explicit arg):
color_preset: e.g."text","primary","danger"size_preset:"title"|"heading"|"body"|"caption"outline_color_preset: e.g."bg"for dark outline on light Set the theme once viacocos_set_ui_theme; un-themed projects fall back todark_gamedefaults so presets always resolve.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| scene_path | Yes | ||
| node_id | Yes | ||
| text | Yes | ||
| font_size | No | ||
| color_r | No | ||
| color_g | No | ||
| color_b | No | ||
| color_a | No | ||
| h_align | No | ||
| v_align | No | ||
| overflow | No | ||
| enable_wrap | No | ||
| line_height | No | ||
| enable_outline | No | ||
| outline_width | No | ||
| cache_mode | No | ||
| color_preset | No | ||
| size_preset | No | ||
| outline_color_preset | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |