A horizontal stack layout that arranges child elements from left to right. Supports automatic size calculation, alignment, and wrapping to multiple rows.
Basic Usage
// Simple horizontal layout via constructornewHStack(newLabel().SetText("Name:"),newEntry().SetPlaceholder("Enter name"))// Using AddChildren fluentlynewHStack().AddChildren(newButton().SetText("Cancel"),newButton().SetText("OK"))// Wrapping layout (like a WrapPanel)newHStack(tag1,tag2,tag3,tag4,tag5).SetWrap(true)
HStack-Specific Methods
Method
Description
SetWrap(bool)
Enables row wrapping when content exceeds width
BindWrap(name, getter)
Binds wrap mode
When Wrap is enabled, elements that exceed the available width wrap to the next row (flowing top to bottom).
Container Methods
Methods inherited from UiLayoutElement:
Method
Description
AddChild(UiElement)
Adds a child element
AddChildren(params UiElement[])
Adds multiple children
RemoveChild(UiElement)
Removes a child element
ClearChildren()
Removes all children
SetFocusScope(FocusScopeMode)
Sets focus trap behavior
BindFocusScope(name, getter)
Binds focus scope
SetAccessibilityLandmark(AccessibilityLandmark)
Sets accessibility landmark
BindAccessibilityLandmark(name, getter)
Binds landmark
FocusScopeMode Values
Value
Description
FocusScopeMode.None
Normal tab navigation (default)
FocusScopeMode.Trap
Tab cycles within container
FocusScopeMode.TrapWithEscape
Tab cycles, Escape exits
AccessibilityLandmark Values
Value
Description
AccessibilityLandmark.None
No landmark (default)
AccessibilityLandmark.Main
Main content area
AccessibilityLandmark.Navigation
Navigation region
AccessibilityLandmark.Search
Search region
AccessibilityLandmark.Banner
Header/banner
AccessibilityLandmark.ContentInfo
Footer information
AccessibilityLandmark.Form
Form region
AccessibilityLandmark.Complementary
Complementary content
Layout Methods
Methods inherited from UiElement:
Method
Description
SetMargin(Margin)
Sets outer margin
BindMargin(name, getter)
Binds margin
SetHorizontalAlignment(HorizontalAlignment)
Sets horizontal alignment
BindHorizontalAlignment(name, getter)
Binds horizontal alignment
SetVerticalAlignment(VerticalAlignment)
Sets vertical alignment
BindVerticalAlignment(name, getter)
Binds vertical alignment
SetDesiredSize(Size)
Sets explicit size
BindDesiredSize(name, getter)
Binds size
SetDesiredWidth(float)
Sets explicit width
BindDesiredWidth(name, getter)
Binds width
SetDesiredHeight(float)
Sets explicit height
BindDesiredHeight(name, getter)
Binds height
HorizontalAlignment Values
Value
Description
HorizontalAlignment.Undefined
Default behavior
HorizontalAlignment.Left
Align to left
HorizontalAlignment.Center
Center horizontally
HorizontalAlignment.Right
Align to right
HorizontalAlignment.Stretch
Stretch to fill width
VerticalAlignment Values
Value
Description
VerticalAlignment.Undefined
Default behavior
VerticalAlignment.Top
Align to top
VerticalAlignment.Center
Center vertically
VerticalAlignment.Bottom
Align to bottom
VerticalAlignment.Stretch
Stretch to fill height
Children with HorizontalAlignment.Stretch divide remaining horizontal space equally.
Appearance Methods
Methods inherited from UiElement:
Method
Description
SetIsVisible(bool)
Shows/hides element
BindIsVisible(name, getter)
Binds visibility
SetOpacity(float)
Sets opacity 0.0-1.0 (default: 1.0)
BindOpacity(name, getter)
Binds opacity
SetBackground(IBackground)
Sets background (gradient, solid, etc.)
SetBackground(Color)
Sets solid color background
BindBackground(name, getter)
Binds background
SetCornerRadius(float)
Sets corner radius
BindCornerRadius(name, getter)
Binds corner radius
SetVisualOffset(Point)
Offsets visual position
BindVisualOffset(name, getter)
Binds visual offset
Shadow Methods
Methods inherited from UiElement:
Method
Description
SetShadowColor(Color)
Sets shadow color
BindShadowColor(name, getter)
Binds shadow color
SetShadowOffset(Point)
Sets shadow offset
BindShadowOffset(name, getter)
Binds shadow offset
SetShadowBlur(float)
Sets shadow blur radius
BindShadowBlur(name, getter)
Binds shadow blur
SetShadowSpread(float)
Sets shadow spread
BindShadowSpread(name, getter)
Binds shadow spread
Accessibility Methods
Methods inherited from UiElement:
Method
Description
SetAccessibilityLabel(string?)
Sets screen reader label
BindAccessibilityLabel(name, getter)
Binds accessibility label
SetAccessibilityHint(string?)
Sets additional context hint
BindAccessibilityHint(name, getter)
Binds accessibility hint
SetAccessibilityValue(string?)
Sets current value description
BindAccessibilityValue(name, getter)
Binds accessibility value
SetAccessibilityTraits(AccessibilityTrait)
Sets accessibility traits
BindAccessibilityTraits(name, getter)
Binds accessibility traits
SetIsAccessibilityElement(bool)
Include in accessibility tree
HStack has AccessibilityRole.Container by default.