Elements

HorizontalGroup

A container element that arranges its children horizontally in a row. Extends Group functionality with horizontal layout and reverse capabilities.

Constructor

new HorizontalGroup(child1, child2, child3);
new HorizontalGroup(); // Empty horizontal group

Examples

Button Layouts

Common horizontal layout patterns for UI controls:

// Action buttons
new HorizontalGroup(
    new Button(new Label("Cancel")),
    new Button(new Label("Save"))
)
.JustifyContent(Justify.FlexEnd);

// Icon and text combinations
var Username = new ReactiveProperty<string>("Player1");

new HorizontalGroup(
    new Image("Icons/user"),
    new Label().BindText(Username)
)
.AlignItems(Align.Center);

Form Layouts

Horizontal arrangements for form elements:

var Email = new ReactiveProperty<string>("");
var IsEmailValid = new ReactiveProperty<bool>(false);
var Name = new ReactiveProperty<string>("");

// Input with validation icon
new HorizontalGroup(
    new TextField(Email).Flex(1),
    new Image("Icons/check").BindVisible(IsEmailValid)
);

// Label and input pairs
new HorizontalGroup(
    new Label("Name:").ClassName("form-label"),
    new TextField(Name).Flex(1)
);

Dynamic Content

Reactive horizontal layouts:

var IsRightToLeft = new ReactiveProperty<bool>(false);

// Conditional reverse layout
new HorizontalGroup(
    new Label("Primary"),
    new Label("Secondary")
)
.BindReverse(IsRightToLeft);

// Dynamic child rendering
var ActionItems = new ReactiveProperty<ActionItem[]>(Array.Empty<ActionItem>());

new HorizontalGroup()
    .BindChildren(
        ActionItems,
        item => new Button(new Label(item.Name))
            .OnClick(_ => ExecuteAction(item))
    );

Properties

PropTypeDefault
children?
IElement[]
[]
reverse?
bool
false
disabled?
bool
false
visible?
bool
true
name?
string
""
pickingMode?
PickingMode
PickingMode.Position

Methods

PropTypeDefault
Reverse?
(bool = true) => HorizontalGroup
-
GetReverse?
() => bool
-
BindReverse?
(Observable<bool>) => HorizontalGroup
-
Flex?
(int flexGrow, int flexShrink = 0) => HorizontalGroup
-
JustifyContent?
(Justify) => HorizontalGroup
-
AlignItems?
(Align) => HorizontalGroup
-
BindChildren?
<TChild>(Observable<TChild[]>, Func<TChild, IElement>) => HorizontalGroup
-
Disabled?
(bool = true) => HorizontalGroup
-
GetDisabled?
() => bool
-
BindDisabled?
(Observable<bool>) => HorizontalGroup
-
Visible?
(bool) => HorizontalGroup
-
GetVisible?
() => bool
-
BindVisible?
(Observable<bool>) => HorizontalGroup
-
ClassName?
(string, bool = true) => HorizontalGroup
-
BindClassName?
(string, Observable<bool>) => HorizontalGroup
-
StyleSheet?
(StyleSheet) => HorizontalGroup or (string) => HorizontalGroup
-

HorizontalGroup extends Group which extends BaseElement.