godot-ui-containers
23
总安装量
3
周安装量
#16232
全站排名
安装命令
npx skills add https://github.com/thedivergentai/gd-agentic-skills --skill godot-ui-containers
Agent 安装分布
opencode
3
gemini-cli
3
codex
3
claude-code
2
github-copilot
2
Skill 文档
UI Containers
Container auto-layout, size flags, anchors, and split ratios define responsive UI systems.
Available Scripts
responsive_layout_builder.gd
Expert container builder with breakpoint-based responsive layouts.
responsive_grid.gd
Auto-adjusting GridContainer that changes column count based on available width. Essential for responsive inventory screens and resizing windows.
NEVER Do in UI Containers
- NEVER set child position/size manually in Container â
child.position = Vector2(10, 10)inside HBoxContainer? Container overrides it on layout. Usecustom_minimum_sizeOR margins instead. - NEVER forget size_flags for expansion â Child in VBoxContainer doesn’t expand? Default is SHRINK. Set
size_flags_vertical = SIZE_EXPAND_FILLfor fill behavior. - NEVER use GridContainer without columns â
GridContainerwith defaultcolumns = 1? Vertical list, wrong layout. ALWAYS setcolumnsproperty to grid width. - NEVER nest too many containers â 10 levels of HBox in VBox in HBox? Re-layout overhead + hard to debug. Flatten OR use Control with custom layout.
- NEVER skip separation override â Default 4px separation? Cramped UI. Override with
add_theme_constant_override("separation", value)for breathing room. - NEVER use ScrollContainer without minimum size â ScrollContainer with no
custom_minimum_size? Expands infinitely, no scrolling. Set minimum OR use anchors.
# VBoxContainer example
# Automatically stacks children vertically
# Children:
# Button ("Play")
# Button ("Settings")
# Button ("Quit")
# Set separation between items
$VBoxContainer.add_theme_constant_override("separation", 10)
Responsive Layout
# Use anchors and size flags
func _ready() -> void:
# Expand to fill parent
$MarginContainer.set_anchors_preset(Control.PRESET_FULL_RECT)
# Add margins
$MarginContainer.add_theme_constant_override("margin_left", 20)
$MarginContainer.add_theme_constant_override("margin_right", 20)
SizeFlags
# Control how children expand in containers
button.size_flags_horizontal = Control.SIZE_EXPAND_FILL
button.size_flags_vertical = Control.SIZE_SHRINK_CENTER
Reference
Related
- Master Skill: godot-master