Tesserae

Layout, Alignment, Stack, and Grid

Tesserae provides flexible layout primitives via Stack (flexbox) and Grid (CSS grid). Use HStack()/VStack() factory methods or Grid(...) to build layouts, and then apply alignment, spacing, and placement via fluent APIs and extensions.

Stack basics

A Stack is a flex container with an orientation:

  • HStack() creates a horizontal stack.
  • VStack() creates a vertical stack.
  • Stack(Orientation) lets you specify a direction explicitly.

Stack alignment APIs map to flexbox properties:

  • AlignItems(...), AlignContent(...)
  • JustifyContent(...), JustifyItems(...)
  • CanWrap, IsInline for wrapping/inline behavior.

Align individual items in a stack

Use extension methods on components to align individual items within a stack:

Alignment helpers are defined on IComponentExtensions and map to Stack.SetAlign/Stack.SetJustify calls.

Grid basics

Grid maps to CSS grid and supports explicit column/row templates:

  • Grid(params UnitSize[] columns) initializes columns.
  • Rows(...), Columns(...), Gap(...), RowGap(...), ColumnGap(...) configure grid behavior.

Placing items

Use GridColumn/GridRow extensions to place items inside grid cells:

These extensions map to Grid.SetGridColumn and Grid.SetGridRow and must be called before the component is added to the grid so the styles are propagated correctly.

Stretching, grow, and spacing helpers

Use layout extensions to control how items size within stacks and grids:

  • Stretch() sets width and height to 100%. Tip: You can also use the short form .S()
  • Grow(int)/Shrink()/NoShrink() map to flex-grow/flex-shrink on stack items.

Referenced by

© 2026 Tesserae. All rights reserved.