jame581/godotprompter

godot-ui

Use when building user interfaces — Control nodes, themes, anchors, containers, and layout patterns

First seen Apr 14, 2026

Installation

$ npx skills add jame581/godotprompter --skill godot-ui

Similar popular skills

Related neighbors and high-traction skills in the same topics — useful to compare before installing.

Also in this package

Other skills from jame581/godotprompter · top by installs.

npx skills add jame581/godotprompter

Browse all from jame581/godotprompter

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Also listed on

Alternate registries and mirrors of this skill.

Repository health

Stars 685
License LICENSE
Default branch master
Open issues 1
Status Active

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 12,853 B
  • docs SUMMARY.md 117 B

History

  1. First seen on skills.sh
  2. First recorded snapshot · 103 installs

SKILL.md

Godot UI — Control Nodes, Themes & Layout

All examples target Godot 4.3+ with no deprecated APIs; GDScript first, then C#.

Related skills: responsive-ui for multi-resolution scaling, hud-system for in-game HUD patterns, dialogue-system for dialogue UI presentation, tween-animation for UI transition and animation effects.


1. Control Node Hierarchy

How Control Differs from Node2D

Control is the base class for all UI nodes — it lives in a separate scene-tree branch from Node2D/Node3D with a fundamentally different layout model.

Feature Node2D Control
Position model World-space position (pixels from parent) Anchor + offset relative to parent rect
Size No intrinsic size Has size, minimumsize, customminimum_size
Theme None Inherits and overrides Theme resources
Focus Not applicable Built-in focus system (focusmode, grabfocus())
Mouse events Manual via _input guiinput, mouseentered, mouse_exited
Layout helpers None Container subclasses auto-arrange children

Control as Base Class

Every UI widget (Button, Label, LineEdit, etc.) extends Control. Key properties defined on Control itself:

  • anchorleft, anchortop, anchorright, anchorbottom — fractional values (0.0–1.0) relative to the parent rect
  • offsetleft, offsettop, offsetright, offsetbottom — pixel offsets applied after the anchor resolves
  • sizeflagshorizontal, sizeflagsvertical — how the node participates in Container layout
  • theme — a Theme resource; if null, walks up the tree to the nearest ancestor with one
  • focus_mode — whether the node can receive keyboard/gamepad focus

Place UI nodes inside a CanvasLayer (or directly under the scene root's built-in canvas) so they render on top of the 3D/2D world, unaffected by Camera transforms.

⚠️ Changed in Godot 4.7: Control.accessibilitylive changed type from DisplayServer.AccessibilityLiveMode to AccessibilityServer.AccessibilityLiveMode (LIVEOFF = 0 default, LIVEPOLITE, LIVEASSERTIVE) — accessibility enums/APIs moved to the new AccessibilityServer singleton. GDScript-compatible; breaks C# binary/source compatibility (rebuild against the new enum). See the 4.7 migration guide.


2. Common Container Nodes

Container Purpose When to Use
VBoxContainer Stacks children vertically Lists, option rows, vertical menus
HBoxContainer Stacks children horizontally Toolbars, stat rows, horizontal nav
GridContainer Arranges children in a fixed-column grid Inventory grids, key-binding tables
MarginContainer Adds padding around a single child Wrapping any node to give it breathing room
PanelContainer Draws a StyleBox background, then lays out children Card UI, dialog boxes, HUD panels
ScrollContainer Makes its single child scrollable; clips overflow Long lists, logs, scrollable settings
TabContainer Stacks children as named tabs; shows one at a time Settings screens, multi-section panels

Sizing tips:

  • Set sizeflagshorizontal = SIZEEXPANDFILL on children that should fill available space.
  • Use customminimumsize to prevent a child from collapsing to zero.
  • MarginContainer reads margin from the theme property margin*; override at runtime with addthemeconstantoverride("margin_left", 16).

Godot 4.7+: custommaximumsize (Vector2(-1, -1)) caps size per axis, prioritized over customminimumsize; propagatemaximumsize (default false) makes a parent's maximum constrain its Control children; getmaximum_size() computes maximums from code.

⚠️ Changed in Godot 4.7: TabContainer.alltabsin_front is deprecated — it does nothing now, since tabs are always in front. Remove code that sets it. See GH-118623.


3. Anchors & Margins

How Anchor Presets Work

An anchor is a point on the parent rect expressed as a fraction (0 = top/left edge, 1 = bottom/right edge). Godot resolves the final pixel position of each edge as:

final_left   = parent_width  * anchor_left   + offset_left
final_top    = parent_height * anchor_top    + offset_top
final_right  = parent_width  * anchor_right  + offset_right
final_bottom = parent_height * anchor_bottom + offset_bottom

The editor exposes built-in presets:

Preset Anchor values Use case
Full Rect L=0, T=0, R=1, B=1 Overlay / fill parent — most common for root UI
Center L=0.5, T=0.5, R=0.5, B=0.5 Fixed-size widget centred in parent
Top Left L=0, T=0, R=0, B=0 Fixed-size widget pinned to top-left corner
Top Right L=1, T=0, R=1, B=0 Fixed-size widget pinned to top-right corner
Bottom Center L=0.5, T=1, R=0.5, B=1 HUD element anchored to bottom centre

Setting Anchors in Code

Anchors resolve as parentsize anchor + offset per edge, so setting them by hand means setting eight properties. setanchorsandoffsetspreset(Control.PRESET) does it in one call — use that, then adjust offset_* for margins (negative on right/bottom).

The anchor-vs-offset rule (keep offsets at 0 and let anchors do the work) plus full GDScript + C# examples — full-rect fill, top-right HUD with 16 px margins, and a custom half-screen side panel: [references/anchors-in-code.md](references/anchors-in-code.md)


4. Theme System

A Theme resource centralizes fonts, colors, and StyleBoxes. Apply at the root and let inheritance do the work; use themeoverride* only for one-off tweaks. StyleBoxFlat covers most flat-design needs (bgcolor, bordercolor, cornerradius, borderwidth); StyleBoxTexture for textures.

See [references/theme-system.md](references/theme-system.md) for the full Theme resource creation walk-through, StyleBoxFlat properties, font overrides, theme inheritance rules, and per-node themeoverride* methods.

Godot 4.7+: GradientTexture2D's Fill enum gains FILL_CONIC — colors interpolated in a cone (angular) pattern; radial progress/cooldown indicators without a shader (C#: FillEnum.Conic).


5. Focus & Navigation

Focus modes (FOCUSNONE, FOCUSCLICK, FOCUSALL) gate keyboard/gamepad navigation. Wire chains with focusneighbortop / bottom / left / right, or rely on automatic spatial detection. Call grab_focus() on the first interactive element when a menu opens.

See [references/focus-and-navigation.md](references/focus-and-navigation.md) for focus mode details, focusneighbor chain examples, gamepad/keyboard input handling, and grabfocus patterns.


6. Common UI Patterns

Three canonical scenes: a main menu (centered VBoxContainer with title + button list), a settings screen with tabs (TabContainer + child panels per category), and a pause menu overlay (full-rect ColorRect background + centered options panel, paused via get_tree().paused = true).

See [references/ui-patterns.md](references/ui-patterns.md) for the full scene-tree fragments and GDScript wiring for each pattern.

Godot 4.7+: offsettransform* — visual-only UI-juice transform (shake/pulse) that never re-triggers container layout; getcursorshape(atposition) — per-position cursor shapes; PopupMenu search bar (searchbarenabled, fuzzy by default) plus setitemindex() for reordering; TextureRect STRETCH_TILE now tiles AtlasTextures (only non-zero margin unsupported). Code: [references/ui-patterns.md](references/ui-patterns.md#godot-47-additions).

⚠️ Changed in Godot 4.7: RichTextLabel.addimage() / updateimage() sizing was reworked — width/height are now float; widthinpercent/heightinpercent bools become widthunit/heightunit, taking the new ImageUnit enum (IMAGEUNITPIXEL, IMAGEUNITPERCENT, IMAGEUNITEM — em scales with font size). ImageUpdateMask.UPDATEWIDTHINPERCENT is renamed UPDATEWIDTHUNIT, breaking GDScript using the old name. See the 4.7 migration guide.


7. Signals

Button.pressed for clicks, Control.guiinput for raw events on a node, Control.mouseentered / mouseexited for hover. Connect in ready() or via the Inspector's Node panel.

See [references/signals.md](references/signals.md) for the complete signal catalog and signal-driven UI update patterns.


8. FoldableContainer (Godot 4.5+)

FoldableContainer is a built-in accordion Container added in Godot 4.5 — a toggle header plus collapsible children, replacing the old boilerplate of wiring a Button to show/hide a VBoxContainer. Set title, set folded for the initial state, add children normally, and listen to foldingchanged(isfolded).

Full GDScript + C# construction, the key-properties table, and the toggle signal: [references/foldable-container.md](references/foldable-container.md)


9. Stacked Label Effects (Godot 4.5+)

Godot 4.5 lets Label and RichTextLabel layer multiple text effects simultaneously — e.g., stacking two outline effects at different widths/colors, or combining a shadow with a glow. Previously, multiple outline layers required duplicating and manually layering Label nodes.

# Configure via Theme Overrides → Constants in the inspector, or add_theme_* overrides at runtime.
func apply_stacked_outlines(label: Label) -> void:
    # Outer outline — wide, dark
    label.add_theme_constant_override("outline_size", 6)
    label.add_theme_color_override("font_outline_color", Color(0.0, 0.0, 0.0, 0.9))

    # Shadow (second layered effect)
    label.add_theme_constant_override("shadow_offset_x", 2)
    label.add_theme_constant_override("shadow_offset_y", 2)
    label.add_theme_color_override("font_shadow_color", Color(0.0, 0.0, 0.0, 0.5))
public void ApplyStackedOutlines(Label label)
{
    // Outer outline — wide, dark
    label.AddThemeConstantOverride("outline_size", 6);
    label.AddThemeColorOverride("font_outline_color", new Color(0f, 0f, 0f, 0.9f));

    // Shadow (second layered effect)
    label.AddThemeConstantOverride("shadow_offset_x", 2);
    label.AddThemeConstantOverride("shadow_offset_y", 2);
    label.AddThemeColorOverride("font_shadow_color", new Color(0f, 0f, 0f, 0.5f));
}

For RichTextLabel, stacked effects can also be applied via BBCode combined with theme overrides:

# Multiple outline-style effects via BBCode + theme
$RichTextLabel.text = "[outline size=4 color=#000000]Level Up![/outline]"
# Additional layers via theme overrides, as above.

Editor workflow: Configure stacked effects via Theme Editor → Label → Constants, or add multiple FontFile-style outline passes in the Font resource. The runtime API (addtheme*_override) above covers dynamic scenarios.


10. Checklist

  • Root UI Control has anchor preset Full Rect (or appropriate preset for the layout)
  • All interactive widgets (Button, LineEdit, Slider) have focusmode = FOCUSALL
  • Decorative nodes (Label, TextureRect) have focusmode = FOCUSNONE
  • Focus neighbours wired for non-linear layouts so gamepad navigation wraps correctly
  • grabfocus() called on the first interactive widget in ready() for each screen
  • Pause menu root Control has processmode = PROCESSMODE_ALWAYS
  • One Theme resource assigned at the screen root — not duplicated on every child
  • StyleBoxFlat used instead of image assets for simple solid-colour panels
  • addtheme*_override() used for per-node overrides rather than assigning a whole new Theme
  • Containers (VBoxContainer, HBoxContainer, etc.) used for layout instead of manual position values
  • customminimumsize set on widgets that must not collapse to zero
  • Slider and volume code uses lineartodb / dbtolinear — not raw linear values mapped to audio bus
  • Signals connected in ready() (or via the editor); no polling of UI state in process
  • Tab order in TabContainer matches logical reading / navigation order
  • Accordion-style collapsible panels use FoldableContainer instead of manual Button + VBoxContainer wiring (Godot 4.5+)
  • Multiple outline/shadow layers on Label/RichTextLabel use stacked theme overrides instead of duplicated nodes (Godot 4.5+)