Wrap Layout
Lays its children out left to right and wraps them onto new rows.
ShellUI for Blazor has no twin (CSS does this with flex-wrap), so the preview below is a flex-wrap row of ShellUI buttons. On Avalonia, use the built-in WrapPanel.
Installation
bash
shellui-native add wrap-layout
Platforms: MAUI · Avalonia.
Usage
Basic
<ui:WrapLayout Spacing="8" LineSpacing="8">
<ui:Button Text="Default" />
<ui:Button Text="Secondary" Variant="Secondary" />
<ui:Button Text="Outline" Variant="Outline" />
<ui:Button Text="Ghost" Variant="Ghost" />
<ui:Button Text="Destructive" Variant="Destructive" />
<ui:Button Text="Link" Variant="Link" />
</ui:WrapLayout><ui:WrapLayout Spacing="8" LineSpacing="8">
<ui:Button Text="Default" />
<ui:Button Text="Secondary" Variant="Secondary" />
<ui:Button Text="Outline" Variant="Outline" />
<ui:Button Text="Ghost" Variant="Ghost" />
<ui:Button Text="Destructive" Variant="Destructive" />
<ui:Button Text="Link" Variant="Link" />
</ui:WrapLayout>Not available on yet
MAUI and Avalonia
- MAUI's
WrapLayouthasPadding; the Avalonia one is aPanelwithout it. - Avalonia's own
WrapPanelcovers plain wrapping. UseWrapLayoutthere forLastChildFill, which lets the last child take the rest of its row.
API
| Property | Type | Default | Description |
|---|---|---|---|
Spacing |
double |
8 |
Gap between children in a row. |
LineSpacing |
double |
8 |
Gap between rows. |
LastChildFill |
bool |
false |
The last child takes what is left of its row (or a row of its own when less than MinimumLastChildWidth remains) — e.g. the text field after a run of chips. |
MinimumLastChildWidth |
double |
96 |
Smallest width the stretched last child may take before it wraps. |
| Method | Description |
|---|---|
Measure(double widthConstraint, double heightConstraint) |
MAUI only. |
ArrangeChildren(Rect bounds) |
MAUI only. |