FoldableContainer
Container with a title and collapsible content.
Place content inside one nested VBoxContainer or another layout container: direct child Controls receive the same inner rectangle and can overlap. Folding hides them and expanding shows them again; manage independent visibility inside the nested container.
Folded sets state without FoldingChanged; Fold/Expand commands emit the actual state. FoldableGroup combines sections into an accordion.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Constructors1
FoldableContainerConstructor
public FoldableContainer();Creates a foldable container. Add it to a parent, set Title and place content in a nested layout container.
Properties8
FoldableGroupProperty
public FoldableGroup FoldableGroup { get; set; }Shared expansion-coordination resource. Assignment joins the new group, leaves the old one and may immediately adjust Folded. null disables coordination.
FoldedProperty
public bool Folded { get; set; }Folding state. The setter requests layout updates without emitting FoldingChanged. A group may reject folding the last expanded member; reread IsFolded after assignment. Layout assigns direct child Controls Visible = !Folded.
LanguageProperty
public string Language { get; set; }Title shaping language hint. Does not itself translate it; UI translation separately uses source Title.
TitleProperty
public string Title { get; set; }Source title, translated through UI translation for display. The getter returns the source string. Does not create a child Label or set the entity name.
TitleAlignmentProperty
public HorizontalAlignment TitleAlignment { get; set; }Title alignment: Left, Center or Right; Fill is unsupported. RTL mirrors left/right presentation. Does not align content controls.
TitlePositionProperty
public FoldableContainer.TitlePositionEnum TitlePosition { get; set; }Places the title bar above or below content. Changes layout rather than child entity order.
TitleTextDirectionProperty
public Control.TextDirection TitleTextDirection { get; set; }Title shaping direction; neither reverses the source string nor controls all content direction.
TitleTextOverrunBehaviorProperty
public TextServer.OverrunBehavior TitleTextOverrunBehavior { get; set; }Title overflow behavior, such as trimming or ellipsis. Does not change stored Title.
Methods22
AddTitleBarControlvoid
public void AddTitleBarControl(Control control);Moves a Control into the title bar’s internal children, removing it from its previous parent. Configure ownership/saving separately when building a prefab. Do not add the same control twice. It is freed with the container while remaining its child.
| Name | Type | Default |
|---|---|---|
control | Control | — |
controlValid title-bar Control.
Expandvoid
public void Expand();Requests Folded false and emits FoldingChanged with actual state even when already expanded. May fold other group members.
Foldvoid
public void Fold();Requests Folded true, then emits FoldingChanged with actual state even if unchanged or rejected by the group. Does not delete content.
GetFoldableGroupFoldableGroup
public FoldableGroup GetFoldableGroup();Shared expansion-coordination resource. Assignment joins the new group, leaves the old one and may immediately adjust Folded. null disables coordination.
FoldableGroupShared expansion-coordination resource. Assignment joins the new group, leaves the old one and may immediately adjust Folded. null disables coordination.
GetLanguagestring
public string GetLanguage();Title shaping language hint. Does not itself translate it; UI translation separately uses source Title.
stringTitle shaping language hint. Does not itself translate it; UI translation separately uses source Title.
GetTitlestring
public string GetTitle();Source title, translated through UI translation for display. The getter returns the source string. Does not create a child Label or set the entity name.
stringSource title, translated through UI translation for display. The getter returns the source string. Does not create a child Label or set the entity name.
GetTitleAlignmentHorizontalAlignment
public HorizontalAlignment GetTitleAlignment();Title alignment: Left, Center or Right; Fill is unsupported. RTL mirrors left/right presentation. Does not align content controls.
HorizontalAlignmentTitle alignment: Left, Center or Right; Fill is unsupported. RTL mirrors left/right presentation. Does not align content controls.
GetTitleBarControlControl
public Control GetTitleBarControl(long index);Returns a registered Control at its current index. A borrowed reference rather than a copy: do not free a control still used in the title bar. Removing entries shifts indices.
| Name | Type | Default |
|---|---|---|
index | long | — |
indexCurrent index from zero through GetTitleBarControlCount() - 1.
ControlReturns a registered Control at its current index. A borrowed reference rather than a copy: do not free a control still used in the title bar. Removing entries shifts indices.
GetTitleBarControlCountint
public int GetTitleBarControlCount();Count of AddTitleBarControl entries rather than content children.
intCount of AddTitleBarControl entries rather than content children.
GetTitlePositionFoldableContainer.TitlePositionEnum
public FoldableContainer.TitlePositionEnum GetTitlePosition();Places the title bar above or below content. Changes layout rather than child entity order.
FoldableContainer.TitlePositionEnumPlaces the title bar above or below content. Changes layout rather than child entity order.
GetTitleTextDirectionControl.TextDirection
public Control.TextDirection GetTitleTextDirection();Title shaping direction; neither reverses the source string nor controls all content direction.
Control.TextDirectionTitle shaping direction; neither reverses the source string nor controls all content direction.
GetTitleTextOverrunBehaviorTextServer.OverrunBehavior
public TextServer.OverrunBehavior GetTitleTextOverrunBehavior();Title overflow behavior, such as trimming or ellipsis. Does not change stored Title.
TextServer.OverrunBehaviorTitle overflow behavior, such as trimming or ellipsis. Does not change stored Title.
IsFoldedbool
public bool IsFolded();Folding state. The setter requests layout updates without emitting FoldingChanged. A group may reject folding the last expanded member; reread IsFolded after assignment. Layout assigns direct child Controls Visible = !Folded.
boolFolding state. The setter requests layout updates without emitting FoldingChanged. A group may reject folding the last expanded member; reread IsFolded after assignment. Layout assigns direct child Controls Visible = !Folded.
RemoveTitleBarControlvoid
public void RemoveTitleBarControl(Control control);Removes a registered title-bar Control and detaches it without freeing it. Reparent it or free it when no longer needed.
| Name | Type | Default |
|---|---|---|
control | Control | — |
controlValid title-bar Control.
SetFoldableGroupvoid
public void SetFoldableGroup(FoldableGroup buttonGroup);Shared expansion-coordination resource. Assignment joins the new group, leaves the old one and may immediately adjust Folded. null disables coordination.
| Name | Type | Default |
|---|---|---|
buttonGroup | FoldableGroup | — |
buttonGroupShared FoldableGroup or null.
SetFoldedvoid
public void SetFolded(bool folded);Folding state. The setter requests layout updates without emitting FoldingChanged. A group may reject folding the last expanded member; reread IsFolded after assignment. Layout assigns direct child Controls Visible = !Folded.
| Name | Type | Default |
|---|---|---|
folded | bool | — |
foldedRequested state; the group may reject folding.
SetLanguagevoid
public void SetLanguage(string language);Title shaping language hint. Does not itself translate it; UI translation separately uses source Title.
| Name | Type | Default |
|---|---|---|
language | string | — |
languageShaping language hint code.
SetTitlevoid
public void SetTitle(string text);Source title, translated through UI translation for display. The getter returns the source string. Does not create a child Label or set the entity name.
| Name | Type | Default |
|---|---|---|
text | string | — |
textSource title for UI translation.
SetTitleAlignmentvoid
public void SetTitleAlignment(HorizontalAlignment alignment);Title alignment: Left, Center or Right; Fill is unsupported. RTL mirrors left/right presentation. Does not align content controls.
| Name | Type | Default |
|---|---|---|
alignment | HorizontalAlignment | — |
alignmentLeft, Center or Right; Fill is unsupported.
SetTitlePositionvoid
public void SetTitlePosition(FoldableContainer.TitlePositionEnum titlePosition);Places the title bar above or below content. Changes layout rather than child entity order.
| Name | Type | Default |
|---|---|---|
titlePosition | FoldableContainer.TitlePositionEnum | — |
titlePositionTop or bottom title position.
SetTitleTextDirectionvoid
public void SetTitleTextDirection(Control.TextDirection textDirection);Title shaping direction; neither reverses the source string nor controls all content direction.
| Name | Type | Default |
|---|---|---|
textDirection | Control.TextDirection | — |
textDirectionTitle shaping direction.
SetTitleTextOverrunBehaviorvoid
public void SetTitleTextOverrunBehavior(TextServer.OverrunBehavior overrunBehavior);Title overflow behavior, such as trimming or ellipsis. Does not change stored Title.
| Name | Type | Default |
|---|---|---|
overrunBehavior | TextServer.OverrunBehavior | — |
overrunBehaviorTitle overflow behavior.
Signals and events1
FoldingChangedEvent
public event FoldableContainer.FoldingChangedEventHandler FoldingChanged;Notification from Fold/Expand or a user toggle. isFolded is actual state rather than a promise that it changed. Direct SetFolded and automatic changes to other group members need not emit this event.
| Name | Type | Default |
|---|---|---|
isFolded | bool | — |
isFoldedActual state after the request rather than a changed-value flag.
FoldableContainer.TitlePositionEnum
| Value | Description |
|---|---|
Bottom = 1 | Makes the title appear at the bottom of the container. Also makes all StyleBoxes flipped vertically. |
Top = 0 | Makes the title appear at the top of the container. |
Theme properties
These are Theme resource keys, not C# properties. Use the matching Control GetTheme…() and AddTheme…Override() methods for each value type.
| Key and type | Description |
|---|---|
collapsed_font_colorColor | The title's font color when collapsed. Default:Color(1, 1, 1, 1) |
font_colorColor | The title's font color when expanded. Default:Color(0.875, 0.875, 0.875, 1) |
font_outline_colorColor | The title's font outline color. Default:Color(1, 1, 1, 1) |
hover_font_colorColor | The title's font hover color. Default:Color(0.95, 0.95, 0.95, 1) |
h_separationint | The horizontal separation between the title's icon and text, and between title bar controls. Default:2 |
icon_max_widthint | The maximum allowed width of the 0 |
outline_sizeint | The title's font outline size. Default:0 |
fontFont | The title's font. |
font_sizeint | The title's font size. |
expanded_arrowTexture2D | The title's icon used when expanded. |
expanded_arrow_mirroredTexture2D | The title's icon used when expanded (for bottom title). |
folded_arrowTexture2D | The title's icon used when folded (for left-to-right layouts). |
folded_arrow_mirroredTexture2D | The title's icon used when collapsed (for right-to-left layouts). |
expanded_soundAudioStream | Played when the container is expanded with any input method. |
focus_soundAudioStream | Played when this |
folded_soundAudioStream | Played when the container is folded with any input method.
Note: This does not play if the container is folded as a result of being part of a |
focusStyleBox | Background used when |
panelStyleBox | Default background for the |
title_collapsed_hover_panelStyleBox | Background used when the mouse cursor enters the title's area when collapsed. |
title_collapsed_panelStyleBox | Default background for the |
title_hover_panelStyleBox | Background used when the mouse cursor enters the title's area when expanded. |
title_panelStyleBox | Default background for the |