DeepWorks Studios Blazor Component Library

Demo user Administrator ยท Blazor Server Library 20261206222504-6e8ff32.dirty

DwsFlexbox

A flex container with every flex container property as a parameter. Direction, wrapping, alignment, spacing and item sizing can change per screen size, at the library's breakpoints or at widths of your own. DwsFlexboxItem gives a single child its own grow, shrink, basis, alignment and order.

Basic

Space is the gap between the items, Padding and Margin the space inside and around the container, all in pixels. A DwsFlexbox is a block-level container: it takes the full width of its parent.

A B C

A B C
Show Code
Flexbox.razor

<DwsFlexbox Name="FlexboxDemo_Basic_Plain">
    <span class="border rounded px-2">A</span>
    <span class="border rounded px-2">B</span>
    <span class="border rounded px-2">C</span>
</DwsFlexbox>

<DwsFlexbox Name="FlexboxDemo_Basic_Spaced" Space="16" Padding="12" Margin="8" BorderColor="DwsColor.Secondary">
    <span class="border rounded px-2">A</span>
    <span class="border rounded px-2">B</span>
    <span class="border rounded px-2">C</span>
</DwsFlexbox>

Gaps

Space sets the gap between the lines and between the items in a line; RowSpace and ColumnSpace set only one of them. Here the lines are 4px apart and the items in a line 24px.

Tag 1Tag 2Tag 3Tag 4Tag 5Tag 6Tag 7Tag 8Tag 9
Show Code
Flexbox.razor

<DwsFlexbox Name="FlexboxDemo_Gaps_Wrap" Wrap="DwsFlexWrap.Wrap" MaxWidth="420" RowSpace="4" ColumnSpace="24" Padding="8" BorderColor="DwsColor.Secondary">
    @foreach (int i in Enumerable.Range(1, 9))
    {
        <span class="border rounded px-2">Tag @i</span>
    }
</DwsFlexbox>

Inline containers

Inline makes an inline-level container (inline-flex) that is only as wide as its content and flows with the text around it; with HtmlTag span it is also valid inside a paragraph.

Text before an inline container new 3 and text after it, on the same line.

Show Code
Flexbox.razor

<DwsTypography Name="FlexboxDemo_Text" Typography="DwsTypographyType.Paragraph">
    Text before an inline container
    <DwsFlexbox Name="FlexboxDemo_Gaps_Inline" Inline="true" HtmlTag="span" Space="4" AlignItems="DwsAlignItems.Center" Padding="2" BorderColor="DwsColor.Success" BorderRadius="4">
        <span class="border rounded px-1">new</span>
        <span class="border rounded px-1">3</span>
    </DwsFlexbox>
    and text after it, on the same line.
</DwsTypography>

Item sizing for every child

ItemGrow, ItemShrink and ItemBasis set single values for every direct child. ItemBasis 160 with ItemGrow 1 and wrapping makes cards at least 160px wide that fill every line. For a single child use DwsFlexboxItem (next examples).

Card 1Card 2Card 3Card 4Card 5Card 6Card 7
Show Code
Flexbox.razor

@* Cards at least 160px wide that fill every line *@
<DwsFlexbox Name="FlexboxDemo_Items_Cards" ItemGrow="1" ItemBasis="160" Wrap="DwsFlexWrap.Wrap" Space="8" Padding="8" BorderColor="DwsColor.Secondary">
    @foreach (int i in Enumerable.Range(1, 7))
    {
        <span class="border rounded px-3 py-2">Card @i</span>
    }
</DwsFlexbox>

Individual items: grow, shrink and order

DwsFlexboxItem gives one child its own Grow, Shrink, Basis and Order, and its values win over the container's item sizing. In this toolbar the title grows and is cut off with an ellipsis (ShrinkBelowContent), the 70px item never shrinks (Shrink 0) and the last item is shown first (Order -1).

A long document title that is cut off with an ellipsis when the space runs out
70px
First
Show Code
Flexbox.razor

<DwsFlexbox Name="FlexboxDemo_Item_Toolbar" AlignItems="DwsAlignItems.Center" MaxWidth="560" Space="8" Padding="8" BorderColor="DwsColor.Secondary">
    <DwsFlexboxItem Name="FlexboxDemo_Item_Title" Grow="1" ShrinkBelowContent="true">
        <span class="d-block text-truncate">A long document title that is cut off with an ellipsis when the space runs out</span>
    </DwsFlexboxItem>
    <DwsFlexboxItem Name="FlexboxDemo_Item_Fixed" Shrink="0" Basis="70" Class="border rounded px-2 text-nowrap">70px</DwsFlexboxItem>
    <DwsFlexboxItem Name="FlexboxDemo_Item_First" Order="-1" Class="border rounded px-2">First</DwsFlexboxItem>
</DwsFlexbox>

Aligning a single item

AlignSelf lets a DwsFlexboxItem leave the container's cross-axis alignment: here two items leave the top alignment for the centre and the bottom.

Top
Center
Bottom
Show Code
Flexbox.razor

<DwsFlexbox Name="FlexboxDemo_Item_Align" AlignItems="DwsAlignItems.FlexStart" Height="70" Space="8" Padding="8" BorderColor="DwsColor.Secondary">
    <span class="border rounded px-2">Top</span>
    <DwsFlexboxItem Name="FlexboxDemo_Item_Center" AlignSelf="DwsAlignItems.Center" Class="border rounded px-2">Center</DwsFlexboxItem>
    <DwsFlexboxItem Name="FlexboxDemo_Item_Bottom" AlignSelf="DwsAlignItems.FlexEnd" Class="border rounded px-2">Bottom</DwsFlexboxItem>
</DwsFlexbox>

A larger share for one item

In a container with AutoLayout Equal every item gets one share; Grow 2 on a DwsFlexboxItem gives it a double share, because the item's own value wins.

1 share
2 shares
1 share
Show Code
Flexbox.razor

@* The item's Grow wins over the container's AutoLayout *@
<DwsFlexbox Name="FlexboxDemo_Item_Shares" AutoLayout="DwsFlexAutoLayout.Equal" Space="8" Padding="8" BorderColor="DwsColor.Secondary">
    <span class="border rounded px-2">1 share</span>
    <DwsFlexboxItem Name="FlexboxDemo_Item_Double" Grow="2" Class="border rounded px-2">2 shares</DwsFlexboxItem>
    <span class="border rounded px-2">1 share</span>
</DwsFlexbox>

Overflow

Overflow handles content that does not fit, on both axes; OverflowX and OverflowY on one axis only. ItemShrink='0' keeps the items at their size, so they overflow instead of being squeezed: a row that scrolls sideways, and a column with a fixed height that scrolls down.

OverflowX Auto
Item 1Item 2Item 3Item 4Item 5Item 6Item 7Item 8Item 9Item 10
Direction Column + Height + OverflowY Auto
Row 1Row 2Row 3Row 4Row 5Row 6Row 7Row 8Row 9Row 10
Show Code
Flexbox.razor

@* A row that scrolls sideways *@
<small class="d-block">OverflowX Auto</small>
<DwsFlexbox Name="FlexboxDemo_Overflow_Row" MaxWidth="280" OverflowX="DwsOverflow.Auto" ItemShrink="0" Space="6" Padding="6" BorderColor="DwsColor.Secondary">
    @foreach (int i in Enumerable.Range(1, 10))
    {
        <span class="border rounded px-2 text-nowrap">Item @i</span>
    }
</DwsFlexbox>

@* A column that scrolls down *@
<small class="d-block">Direction Column + Height + OverflowY Auto</small>
<DwsFlexbox Name="FlexboxDemo_Overflow_Column" Direction="DwsFlexDirection.Column" MaxWidth="280" Height="140" OverflowY="DwsOverflow.Auto" ItemShrink="0" Space="6" Padding="6" BorderColor="DwsColor.Secondary">
    @foreach (int i in Enumerable.Range(1, 10))
    {
        <span class="border rounded px-2">Row @i</span>
    }
</DwsFlexbox>

Background

BackgroundColor takes a theme color, so it follows the active theme; BorderRadius rounds the corners.

Primary background ยท rounded
Show Code
Flexbox.razor

<DwsFlexbox Name="FlexboxDemo_Appearance_Primary" BackgroundColor="DwsColor.Primary" Space="8" Padding="12" BorderRadius="8">
    <span>Primary background</span>
    <span>·</span>
    <span>rounded</span>
</DwsFlexbox>

Border

BorderColor takes a theme color. A BorderColor or BorderWidth alone draws a solid border; BorderStyle picks another style.

Dashed success border
Show Code
Flexbox.razor

<DwsFlexbox Name="FlexboxDemo_Appearance_Border" BorderColor="DwsColor.Success" BorderWidth="2" BorderStyle="DwsBorderStyle.Dashed" BorderRadius="8" Space="8" Padding="12">
    <span>Dashed success border</span>
</DwsFlexbox>

Responsive layout

Breakpoints switch direction, wrapping, alignment and spacing from a screen width up (mobile first); values an entry leaves out are inherited from the smaller one. Resize the window: a column below 768px (MD), a row from there, centred with a 32px gap from 992px (LG).

Card 1Card 2Card 3
Show Code
Flexbox.razor

<DwsFlexbox Name="FlexboxDemo_Responsive_Box" Direction="DwsFlexDirection.Column" Space="8" Padding="8" BorderColor="DwsColor.Secondary"
            Breakpoints="_responsiveBreakpoints">
    @foreach (int i in Enumerable.Range(1, 3))
    {
        <span class="border rounded px-3 py-2">Card @i</span>
    }
</DwsFlexbox>
Flexbox.razor.cs

// A row from 768px up, centred with a 32px gap from 992px. Values left null keep the smaller breakpoint's value.
private static readonly IReadOnlyList<DwsFlexboxBreakpoint> _responsiveBreakpoints =
[
    new DwsFlexboxBreakpoint { Breakpoint = DwsVisibilityBreakpoint.MD, Direction = DwsFlexDirection.Row, Space = 12 },
    new DwsFlexboxBreakpoint { Breakpoint = DwsVisibilityBreakpoint.LG, JustifyContent = DwsJustifyContent.Center, Space = 32 },
];

Responsive item sizing

Breakpoints switch the item sizing too. Resize the window: below 768px the cards stack at their own height, from MD they become equal columns (AutoLayout Equal), and from 1200px (XL) they go back to their own width (AutoLayout None) in a centred row.

Short A card with a little more text Medium card
Show Code
Flexbox.razor

<DwsFlexbox Name="FlexboxDemo_ResponsiveItems_Box" Direction="DwsFlexDirection.Column" Space="8" Padding="8" BorderColor="DwsColor.Secondary"
            Breakpoints="_responsiveItemBreakpoints">
    <span class="border rounded px-3 py-2">Short</span>
    <span class="border rounded px-3 py-2">A card with a little more text</span>
    <span class="border rounded px-3 py-2">Medium card</span>
</DwsFlexbox>
Flexbox.razor.cs

// A stack on small screens, equal columns from 768px, and from 1200px the cards' own width in a centred row.
private static readonly IReadOnlyList<DwsFlexboxBreakpoint> _responsiveItemBreakpoints =
[
    new DwsFlexboxBreakpoint { Breakpoint = DwsVisibilityBreakpoint.MD, Direction = DwsFlexDirection.Row, AutoLayout = DwsFlexAutoLayout.Equal },
    new DwsFlexboxBreakpoint { Breakpoint = DwsVisibilityBreakpoint.XL, AutoLayout = DwsFlexAutoLayout.None, JustifyContent = DwsJustifyContent.Center, Space = 24 },
];

Custom breakpoints

MinWidth sets a breakpoint of your own, for a layout change that none of the fixed widths fits, and mixes with them in width order. Resize the window: a column below 700px, a wrapping row from there, spread out from 1100px, and a 24px gap from 1200px (XL).

Card 1Card 2Card 3Card 4
Show Code
Flexbox.razor

<DwsFlexbox Name="FlexboxDemo_CustomBreakpoints_Box" Direction="DwsFlexDirection.Column" Space="8" Padding="8" BorderColor="DwsColor.Secondary"
            Breakpoints="_customBreakpoints">
    @foreach (int i in Enumerable.Range(1, 4))
    {
        <span class="border rounded px-3 py-2">Card @i</span>
    }
</DwsFlexbox>
Flexbox.razor.cs

// MinWidth is a breakpoint of your own; the entries apply in width order: 700px, 1100px, then XL (1200px).
private static readonly IReadOnlyList<DwsFlexboxBreakpoint> _customBreakpoints =
[
    new DwsFlexboxBreakpoint { MinWidth = 700, Direction = DwsFlexDirection.Row, Wrap = DwsFlexWrap.Wrap },
    new DwsFlexboxBreakpoint { Breakpoint = DwsVisibilityBreakpoint.XL, Space = 24 },
    new DwsFlexboxBreakpoint { MinWidth = 1100, JustifyContent = DwsJustifyContent.SpaceBetween },
];

Adaptive to the parent

With Adaptive the breakpoints follow the width of the parent instead of the window. Both boxes below are the same component with the same parameters: the one in the 280px wide sidebar stays a column, the one in the wider area becomes a centred row from 400px of parent width. The parent needs a width of its own (here a block element).

Sidebar (280px)
Card 1Card 2Card 3
Main area
Card 1Card 2Card 3
Show Code
Flexbox.razor

<DwsFlexbox Name="FlexboxDemo_Adaptive_Layout" Wrap="DwsFlexWrap.Wrap" Space="12">
    <div class="border rounded p-2" style="width: 280px; max-width: 100%;">
        <small class="d-block mb-1">Sidebar (280px)</small>
        <div>
            <DwsFlexbox Name="FlexboxDemo_Adaptive_Sidebar" Adaptive="true" Direction="DwsFlexDirection.Column" Space="8" Breakpoints="_adaptiveBreakpoints">
                @foreach (int i in Enumerable.Range(1, 3))
                {
                    <span class="border rounded px-3 py-2">Card @i</span>
                }
            </DwsFlexbox>
        </div>
    </div>
    <div class="border rounded p-2" style="flex: 1 1 320px;">
        <small class="d-block mb-1">Main area</small>
        <div>
            <DwsFlexbox Name="FlexboxDemo_Adaptive_Main" Adaptive="true" Direction="DwsFlexDirection.Column" Space="8" Breakpoints="_adaptiveBreakpoints">
                @foreach (int i in Enumerable.Range(1, 3))
                {
                    <span class="border rounded px-3 py-2">Card @i</span>
                }
            </DwsFlexbox>
        </div>
    </div>
</DwsFlexbox>
Flexbox.razor.cs

// From 400px of parent width up: a centred row with a 24px gap.
private static readonly IReadOnlyList<DwsFlexboxBreakpoint> _adaptiveBreakpoints =
[
    new DwsFlexboxBreakpoint { MinWidth = 400, Direction = DwsFlexDirection.Row, JustifyContent = DwsJustifyContent.Center, Space = 24 },
];

Custom element

HtmlTag renders the container as another layout element, e.g. nav for a link bar or ul for a list whose items sit in a row. The list's default indent is reset; list-unstyled removes the bullets.

  • First
  • Second
  • Third
Show Code
Flexbox.razor

<DwsFlexbox Name="FlexboxDemo_Tag_Nav" HtmlTag="nav" Space="16">
    <DwsAnchorLink Name="FlexboxDemo_Tag_ApiLink" href="#apiReference" Color="DwsColor.Link">API</DwsAnchorLink>
    <DwsLink Name="FlexboxDemo_Tag_HorizontalLink" Href="horizontal" Color="DwsColor.Link">DwsHorizontal</DwsLink>
    <DwsLink Name="FlexboxDemo_Tag_SpacerLink" Href="spacer" Color="DwsColor.Link">DwsSpacer</DwsLink>
</DwsFlexbox>

<DwsFlexbox Name="FlexboxDemo_Tag_List" HtmlTag="ul" Space="8" Class="list-unstyled">
    <li class="border rounded px-2">First</li>
    <li class="border rounded px-2">Second</li>
    <li class="border rounded px-2">Third</li>
</DwsFlexbox>

Nested flexboxes

DwsFlexboxes nest into whole layouts. Grow lets a nested one take the free space along its parent's main axis and shrink below its content: the main area fills the width next to the fixed sidebar, and inside it the content fills the height under the header and scrolls instead of stretching the page.

Reports New
Report 1Report 2Report 3Report 4Report 5Report 6Report 7Report 8Report 9Report 10Report 11Report 12Report 13Report 14Report 15Report 16Report 17Report 18Report 19Report 20
Show Code
Flexbox.razor

<DwsFlexbox Name="FlexboxDemo_Nested_Page" Height="260" Space="8" Padding="8" BorderColor="DwsColor.Secondary">
    <DwsFlexbox Name="FlexboxDemo_Nested_Sidebar" HtmlTag="nav" Direction="DwsFlexDirection.Column" Width="110" Space="4" Padding="6" BorderColor="DwsColor.Primary">
        <span class="border rounded px-2">Home</span>
        <span class="border rounded px-2">Reports</span>
        <span class="border rounded px-2">Settings</span>
    </DwsFlexbox>
    <DwsFlexbox Name="FlexboxDemo_Nested_Main" Grow="true" Direction="DwsFlexDirection.Column" Space="8">
        <DwsFlexbox Name="FlexboxDemo_Nested_Header" JustifyContent="DwsJustifyContent.SpaceBetween" AlignItems="DwsAlignItems.Center" Wrap="DwsFlexWrap.Wrap" Space="4" Padding="6" BorderColor="DwsColor.Success">
            <strong>Reports</strong>
            <span class="border rounded px-2">New</span>
        </DwsFlexbox>
        <DwsFlexbox Name="FlexboxDemo_Nested_Content" Grow="true" Wrap="DwsFlexWrap.Wrap" AlignContent="DwsAlignContent.FlexStart"
                    ItemGrow="1" ItemBasis="120" OverflowY="DwsOverflow.Auto" Space="6" Padding="6" BorderColor="DwsColor.Secondary">
            @foreach (int i in Enumerable.Range(1, 20))
            {
                <span class="border rounded px-2 py-3">Report @i</span>
            }
        </DwsFlexbox>
    </DwsFlexbox>
</DwsFlexbox>

Debugging

Debug outlines the container and its direct children, tints the padding (darker) and the content box (lighter, the gaps show through), labels the container with its Name and tag and logs the resolved layout once. Use it while building a page and remove it afterwards.

Start
A B
End
Show Code
Flexbox.razor

<DwsButton Name="FlexboxDemo_Debug_Toggle" Class="mb-3" Appearance="@(_debug ? DwsAppearance.Filled : DwsAppearance.Outline)" ButtonSize="DwsSize.Small" OnClick="ToggleDebug">Debug: @(_debug ? "on" : "off")</DwsButton>

<DwsFlexbox Name="FlexboxDemo_Debug_Outer" Debug="_debug" JustifyContent="DwsJustifyContent.Center" AlignItems="DwsAlignItems.Center" Height="160" Space="16" Padding="16">
    <span class="px-2">Start</span>
    <DwsFlexbox Name="FlexboxDemo_Debug_Inner" HtmlTag="section" Debug="_debug" AlignItems="DwsAlignItems.Center" Space="8" Padding="12">
        <span class="px-2">A</span>
        <span class="px-2 py-3">B</span>
    </DwsFlexbox>
    <span class="px-2">End</span>
</DwsFlexbox>
Flexbox.razor.cs

private bool _debug = true;

private void ToggleDebug() => _debug = !_debug;

Debug grid

DebugGrid lays a grid over the content box, with the centre lines drawn stronger, to check how the items line up. DebugGridSize sets the grid spacing in pixels.

Start A End
Show Code
Flexbox.razor

<DwsButton Name="FlexboxDemo_DebugGrid_Toggle" Appearance="@(_debugGrid ? DwsAppearance.Filled : DwsAppearance.Outline)" ButtonSize="DwsSize.Small" OnClick="ToggleDebugGrid">DebugGrid: @(_debugGrid ? "on" : "off")</DwsButton>
<small class="ms-2">Grid size</small>
@foreach (int size in _debugGridSizes)
{
    <DwsButton Name="@($"FlexboxDemo_DebugGridSize_{size}")"
               Appearance="@(size == _debugGridSize ? DwsAppearance.Filled : DwsAppearance.Outline)"
               ButtonSize="DwsSize.Small"
               OnClick="() => _debugGridSize = size">@(size)px</DwsButton>
}

<DwsFlexbox Name="FlexboxDemo_DebugGrid_Box" DebugGrid="_debugGrid" DebugGridSize="_debugGridSize"
            JustifyContent="DwsJustifyContent.Center" AlignItems="DwsAlignItems.Center" Height="160" Space="16" Padding="16" BorderColor="DwsColor.Secondary">
    <span class="border rounded px-2">Start</span>
    <span class="border rounded px-2 py-3">A</span>
    <span class="border rounded px-2">End</span>
</DwsFlexbox>
Flexbox.razor.cs

private static readonly int[] _debugGridSizes = [8, 16, 24];

private bool _debugGrid = true;
private int _debugGridSize = 8;

private void ToggleDebugGrid() => _debugGrid = !_debugGrid;

Interface-Description

Name Typ Default Description
ChildContent RenderFragment? null The child items laid out in the container.
HtmlTag string "div" Element the container renders as: div, section, article, aside, nav, header, footer, main, form, fieldset, figure, ul, ol, li, menu, p, span, label or address. Anything else falls back to div and is logged as a warning.
Inline bool false Renders an inline-level container (display: inline-flex) that is only as wide as its content and flows with the text around it. Use HtmlTag span inside a paragraph.
Direction DwsFlexDirection DwsFlexDirection.Row Main axis the items are laid out along (flex-direction): Row, RowReverse, Column, ColumnReverse.
Wrap DwsFlexWrap DwsFlexWrap.NoWrap Whether items that do not fit move onto a new line (Wrap, WrapReverse) or stay on one line (NoWrap).
JustifyContent DwsJustifyContent DwsJustifyContent.FlexStart Distribution of the items along the main axis: FlexStart, FlexEnd, Center, SpaceBetween, SpaceAround, SpaceEvenly.
AlignItems DwsAlignItems DwsAlignItems.Stretch Alignment of the items on the cross axis: Stretch, FlexStart, FlexEnd, Center, Baseline.
AlignContent DwsAlignContent DwsAlignContent.Stretch Distribution of the lines on the cross axis when the items wrap: Stretch, FlexStart, FlexEnd, Center, SpaceBetween, SpaceAround, SpaceEvenly. No effect on a single line.
Space int? null Gap between the items in pixels, between the lines and within a line. Negative values are ignored with a warning.
RowSpace int? null Gap between the lines (row-gap) in pixels; wins over Space there. Negative values count as unset and are logged.
ColumnSpace int? null Gap between the items within a line (column-gap) in pixels; wins over Space there. Negative values count as unset and are logged.
Padding int? null Inner padding in pixels. Negative values are ignored with a warning.
Margin int? null Outer margin in pixels.
Overflow DwsOverflow? null How content that does not fit is handled, on both axes: Visible, Hidden, Clip, Scroll or Auto. Null keeps the CSS default (visible).
OverflowX DwsOverflow? null Overflow on the horizontal axis only; wins over Overflow there.
OverflowY DwsOverflow? null Overflow on the vertical axis only; wins over Overflow there.
Breakpoints IReadOnlyList<DwsFlexboxBreakpoint>? null Layout and item sizing values (Direction, Wrap, JustifyContent, AlignItems, AlignContent, Space, RowSpace, ColumnSpace, Padding, Margin, AutoLayout, ItemGrow, ItemShrink, ItemBasis) that apply from a width up: at Breakpoint (SM 576px, MD 768px, LG 992px, XL 1200px, XXL 1400px) or at a MinWidth in pixels of your own, which wins over Breakpoint. Mobile first; values left null are inherited from the smaller entry. An XS or MinWidth 0 entry replaces the component's own parameters; the last entry wins when a width is listed twice. Rendered as a small style element right before the container.
Adaptive bool false Applies Breakpoints at the width of the parent element instead of the viewport. The parent becomes a CSS size container: it needs a width of its own (a block element, a stretched flex or grid item), and it becomes the containing block of fixed-position content inside it. A parent that declares its own container-type keeps it.
AutoLayout DwsFlexAutoLayout DwsFlexAutoLayout.None Sizes the direct child items: None keeps their own size, Fill grows them into the free space from their content size, Equal gives them equal shares whatever their content (a column needs a height for the shares to be equal; without one each item keeps its content height). A child's own class or style, and a DwsFlexboxItem, wins.
ItemGrow double? null flex-grow of every direct child item (its share of the free space); overrides AutoLayout. Negative values are ignored with a warning.
ItemShrink double? null flex-shrink of every direct child item (its share of the missing space); 0 keeps the items at their size. Overrides AutoLayout. Negative values are ignored with a warning.
ItemBasis int? null flex-basis of every direct child item in pixels: its size along the main axis before growing or shrinking. Overrides AutoLayout. Negative values are ignored with a warning.
Grow bool false Fills the free space along a flex parent's main axis and may shrink below its content, for a nested DwsFlexbox next to fixed-size siblings.
Width int? null Width in pixels.
MinWidth int? null Minimum width in pixels.
MaxWidth int? null Maximum width in pixels.
Height int? null Height in pixels.
MinHeight int? null Minimum height in pixels.
MaxHeight int? null Maximum height in pixels.
BackgroundColor DwsColor DwsColor.Undefined Theme color of the background.
BorderColor DwsColor DwsColor.Undefined Theme color of the border. On its own it draws a solid 1px border.
BorderWidth int? null Border width in pixels. Draws a solid border when no BorderStyle is set.
BorderStyle DwsBorderStyle DwsBorderStyle.None Border style (Solid, Dashed, Dotted, ...). None with a BorderColor or BorderWidth means solid.
BorderRadius int? null Corner radius in pixels.
Debug bool false Outlines the container and its direct children, tints the padding and content box, labels the container with its Name and tag, and logs the resolved layout once.
DebugGrid bool false Lays a grid over the content box, with its two centre lines drawn stronger, to check how the items line up. Works with or without Debug. In a container that scrolls it covers the area visible at scroll position 0.
DebugGridSize int 8 Cell size of the DebugGrid in pixels. Smaller than 2 falls back to 8 with a warning.
OnClickPropagation bool true Whether a click bubbles on to the parent elements. Turn it off so a clickable nested DwsFlexbox does not click its parent as well.
Name Typ Description
OnClick EventCallback<MouseEventArgs> Raised on click. Not raised while disabled or in permission register mode, where a click selects the container instead.
OnDoubleClick EventCallback<MouseEventArgs> Raised on double click. Not raised while disabled or in permission register mode.
OnMouseEnter EventCallback<MouseEventArgs> Raised when the pointer enters the container. Not raised while disabled or in permission register mode.
OnMouseLeave EventCallback<MouseEventArgs> Raised when the pointer leaves the container. Not raised while disabled or in permission register mode.
Name Typ Default Description
Element ElementReference The associated web component. May be null if accessed before the component is rendered.
ComponentGuid Guid Unique identifier for the component.
TypeString string The name of the component type, obtained from reflection.
Authorized_RegisterEnabled bool false Indicates whether this component is enabled through a permission registry.
Authorized_RegisterSelected bool false Indicates whether this component is selected in permission selection mode.
GetInitializedState bool false Returns whether the component is initialized.
GetRenderModeState DwsRenderMode Returns the current render mode.
GetComponentState DwsComponentStateType Returns the current component state.
GetIsInteractiveState bool false Returns whether the component is interactive.
GetIsPrerenderingState bool false Returns whether the component is prerendering.
GetComponentLoadingState bool false Returns whether the component is loading.
IsFormBusy bool false Whether the DwsForm (or DwsFormBusyRegion) around the component is locked because its submit handler is running. The state itself is the cascaded FormBusyState (IDwsFormBusyState).
Name Typ Parameters Description
DebugInfo void Logs debug information about the component.
UpdateState void Updates the component's state and triggers StateHasChanged.
UpdateStateAsync Task Asynchronously updates the component's state and triggers StateHasChanged.
Dispose void Disposes the component and releases resources.
FocusAsync ValueTask bool containedInScrollableList Sets focus to the component's element.
Name Typ Default Description
Name string Required unique identifier for the component within its container.
Visible bool true Determines if the component is visible in the UI.
Disabled bool false Disables the form control, ensuring it doesn't participate in form submission.
ComponentNameSpace string The namespace for permission-based access control.
PermissionKey string? null A stable key that takes the place of Name in the generated permission namespace (Page.PermissionKey): the stored permission survives a rename, and components that share a key share one permission entry. Null: keyed by Name. Read once, when the component registers; an explicit ComponentNameSpace wins.
Class string Optional CSS class names.
Style string Optional in-line styles.
Tag object An optional user-defined object to store any additional data with the component.
BackReference DwsReference A reference to the enclosing component.
ID string The HTML ID attribute for the component.
AdditionalAttributes Dictionary<string, object> Additional HTML attributes for the component's root element.
IgnorePermissionChecks bool false Bypasses all permission checks for this component.
IgnorePermissionSelection bool false Ignore permission selection mode for this component.
IgnoreFormBusy bool false Takes the component out of the submit lock of the DwsForm (or DwsFormBusyRegion) around it: IsFormBusy stays false for it.
Name Typ Description
OnInitializedCallbackStarted EventCallback Callback when OnInitialized starts.
OnInitializedCallback EventCallback Callback during OnInitialized.
OnInitializedCallbackCompleted EventCallback Callback when OnInitialized completes.
OnInitializedAsyncCallbackStarted EventCallback Callback when OnInitializedAsync starts.
OnInitializedAsyncCallback EventCallback Callback during OnInitializedAsync.
OnInitializedAsyncCallbackCompleted EventCallback Callback when OnInitializedAsync completes.
OnIsComponentLoadingChanged EventCallback<bool> Callback when IsComponentLoading changes.
OnCurrentRenderModeChanged EventCallback<DwsRenderMode> Callback when CurrentRenderMode changes.
OnComponentStateChanged EventCallback<DwsComponentStateType> Callback when ComponentState changes.

Interface-Description

Name Typ Default Description
ChildContent RenderFragment? null The content of the item.
HtmlTag string "div" Element the item renders as, from the same list as DwsFlexbox (e.g. li inside an HtmlTag ul flexbox). Anything else falls back to div and is logged as a warning.
Grow double? null flex-grow: the item's share of the free space. Wins over the container's ItemGrow and AutoLayout. Negative values are ignored with a warning.
Shrink double? null flex-shrink: the item's share of the missing space; 0 keeps it at its size. Wins over the container's ItemShrink and AutoLayout.
Basis int? null flex-basis in pixels: the item's size along the main axis before it grows or shrinks. Wins over the container's ItemBasis and AutoLayout.
AlignSelf DwsAlignItems? null The item's own alignment on the cross axis (Stretch, FlexStart, FlexEnd, Center, Baseline) instead of the container's AlignItems. Null follows the container.
Order int? null The item's place among the items, lower first (the others are 0). Changes only what is shown, not the reading and tab order.
ShrinkBelowContent bool false Lets the item shrink below its content (min-width and min-height 0), e.g. for text cut off with an ellipsis or a scroll area inside.
Name Typ Default Description
Element ElementReference The associated web component. May be null if accessed before the component is rendered.
ComponentGuid Guid Unique identifier for the component.
TypeString string The name of the component type, obtained from reflection.
Authorized_RegisterEnabled bool false Indicates whether this component is enabled through a permission registry.
Authorized_RegisterSelected bool false Indicates whether this component is selected in permission selection mode.
GetInitializedState bool false Returns whether the component is initialized.
GetRenderModeState DwsRenderMode Returns the current render mode.
GetComponentState DwsComponentStateType Returns the current component state.
GetIsInteractiveState bool false Returns whether the component is interactive.
GetIsPrerenderingState bool false Returns whether the component is prerendering.
GetComponentLoadingState bool false Returns whether the component is loading.
IsFormBusy bool false Whether the DwsForm (or DwsFormBusyRegion) around the component is locked because its submit handler is running. The state itself is the cascaded FormBusyState (IDwsFormBusyState).
Name Typ Parameters Description
DebugInfo void Logs debug information about the component.
UpdateState void Updates the component's state and triggers StateHasChanged.
UpdateStateAsync Task Asynchronously updates the component's state and triggers StateHasChanged.
Dispose void Disposes the component and releases resources.
FocusAsync ValueTask bool containedInScrollableList Sets focus to the component's element.
Name Typ Default Description
Name string Required unique identifier for the component within its container.
Visible bool true Determines if the component is visible in the UI.
Disabled bool false Disables the form control, ensuring it doesn't participate in form submission.
ComponentNameSpace string The namespace for permission-based access control.
PermissionKey string? null A stable key that takes the place of Name in the generated permission namespace (Page.PermissionKey): the stored permission survives a rename, and components that share a key share one permission entry. Null: keyed by Name. Read once, when the component registers; an explicit ComponentNameSpace wins.
Class string Optional CSS class names.
Style string Optional in-line styles.
Tag object An optional user-defined object to store any additional data with the component.
BackReference DwsReference A reference to the enclosing component.
ID string The HTML ID attribute for the component.
AdditionalAttributes Dictionary<string, object> Additional HTML attributes for the component's root element.
IgnorePermissionChecks bool false Bypasses all permission checks for this component.
IgnorePermissionSelection bool false Ignore permission selection mode for this component.
IgnoreFormBusy bool false Takes the component out of the submit lock of the DwsForm (or DwsFormBusyRegion) around it: IsFormBusy stays false for it.
Name Typ Description
OnInitializedCallbackStarted EventCallback Callback when OnInitialized starts.
OnInitializedCallback EventCallback Callback during OnInitialized.
OnInitializedCallbackCompleted EventCallback Callback when OnInitialized completes.
OnInitializedAsyncCallbackStarted EventCallback Callback when OnInitializedAsync starts.
OnInitializedAsyncCallback EventCallback Callback during OnInitializedAsync.
OnInitializedAsyncCallbackCompleted EventCallback Callback when OnInitializedAsync completes.
OnIsComponentLoadingChanged EventCallback<bool> Callback when IsComponentLoading changes.
OnCurrentRenderModeChanged EventCallback<DwsRenderMode> Callback when CurrentRenderMode changes.
OnComponentStateChanged EventCallback<DwsComponentStateType> Callback when ComponentState changes.
An error has occurred. This app may no longer respond until reloaded.