Skip to content

Stack Panel

Class: FxStackPanel · Tag: <fx-stack-panel>

The <fx-stack-panel> component is a core structural layout element modeled after the WPF/Avalonia StackPanel. It arranges nested child elements sequentially in a single line, either vertically or horizontally, simplifying HMI console layout construction.


Register the component by importing it directly in your application entrypoint:

import '@salsafx/ui';

Interactive preview of the main variants:


Arranges components vertically with specified spacing:

<fx-stack-panel
spacing="16px"
padding="20px"
>
<fx-push-button label="System Start" background-color="#06b6d4"></fx-push-button>
<fx-push-button label="Calibration" background-color="#3b82f6"></fx-push-button>
<fx-push-button label="Emergency Stop" background-color="#ef4444"></fx-push-button>
</fx-stack-panel>

Arranges components horizontally:

<fx-stack-panel
orientation="horizontal"
spacing="24px"
>
<fx-push-button
label="Power"
background-color="#06b6d4"
shape="round"
></fx-push-button>
<fx-push-button
label="Ignition"
background-color="#fdba74"
shape="round"
></fx-push-button>
<fx-push-button
label="E-Stop"
background-color="#ef4444"
shape="round"
></fx-push-button>
</fx-stack-panel>

PropertyAttributeTypeDefaultDescription
orientationorientationString"vertical"Flow direction of the stacked elements ("vertical" or "horizontal").
spacingspacingString"0px"Spacing gap between child elements.
alignXalign-xString"center"Horizontal content alignment ("left", "center", "right", "stretch").
alignYalign-yString"center"Vertical content alignment ("top", "center", "bottom", "stretch").
widthwidthString""Optional width override.
heightheightString""Optional height override.
paddingpaddingString""Padding inside the panel.
NameDescription
Default slot for nested children to stack.

classDiagram
    direction TB
    class FxElement
    class FxContainerElement
    class FxContentElement
    class FxStackPanel

    FxElement <|-- FxContainerElement
    FxContainerElement <|-- FxContentElement
    FxContentElement <|-- FxStackPanel

See also Architecture.