Stack

A FluentStack is a container-type component that can be used to arrange its child components in a horizontal or vertical stack.

Characteristics

Although the FluentStack component has a number of different parameters, there are some in particular that define the overall layout that the component has:

  1. Orientation: Refers to whether the stacking of child components is horizontal (default) or vertical.
  2. Alignment: Refers to how the child components are aligned inside the container. This is controlled via the HorizontalAlignment and VerticalAlignment parameters.
  3. Spacing: Refers to the space that exists between child components inside the Stack. This is controlled via the HorizontalGap and VerticalGap parameters.

Wrapping

Aside from the previously mentioned parameters, there is another parameter called Wrap that determines if items overflow the FluentStack container or wrap around it. The wrap property only works in the direction of the FluentStack, which means that the children components can still overflow in the perpendicular direction (i.e. in a vertical FluentStack, items might overflow horizontally and vice versa).

Nesting

Stacks can be nested inside one another in order to be able to configure the layout of the application as desired.

Examples

Default example

This FluentStack is using all the default settings for its parameters. To make it clear what the default size is, it is rendered with a border here.
Example
This is some content displayed in a div
This is some content displayed in a div
Download: 

Using the FluentStack component

This example shows two FluentStacks. The first FluentStack has its Orientation parameter set to Orientation.Vertical. Its height has been set to 200 pixels and the VerticalGap has been set to 20 pixels. The second, nested, FluentStack has its Orientation parameter set to Orientation.Horizontal. The HorizontalGap has been set to 4 pixels. Its first element contains a forced break. No height has been set, so the container height adjusts to the height of the highest element.
The alignment of the contents of both FluentStacks can be changed by selecting one the different options from each of the listboxes (which are placed in a FluentStack themselves as well).
Example

Alignment of the Stack content elements:

Horizontal
LeftStartCenterRightEndStretchSpaceBetween
Vertical
TopCenterBottomStretchSpaceBetween
Reversed

Result:

Vertical item 1
Vertical item 2
Horizontal
item 1
Horizontal item 2
Download: 

Documentation

FluentStack Class

Parameters

Name
Type
Default
Description
ChildContentRenderFragment?
Gets or sets the content to be rendered inside the component.
HorizontalAlignmentHorizontalAlignment
Left
Gets or sets the horizontal alignment of the components in the stack.
Default is HorizontalAlignment.Left
HorizontalGapint?
10
Gets or sets the gap between horizontally stacked components (in pixels).
Default is 10 pixels.
OrientationOrientation
Horizontal
Gets or sets the orientation of the stacked components.
Default is Orientation.Horizontal.
Reversedbool?
Gets or sets a value indicating whether the stack is reversed.
VerticalAlignmentVerticalAlignment
Top
Gets or sets the vertical alignment of the components in the stack.
Default is VerticalAlignment.Top
VerticalGapint?
10
Gets or sets the gap between vertically stacked components (in pixels).
Default is 10 pixels.
Widthstring?
100%
Gets or sets the width of the stack as a percentage string (default = 100%).
Wrapbool
False
Gets or sets a value indicating whether the stack wraps.
Left
Start
Center
Right
End
Stretch
SpaceBetween
Horizontal
Vertical
Top
Center
Bottom
Stretch
SpaceBetween
An error has occurred. This application may no longer respond until reloaded. Reload 🗙