# Xui.Core.UI.Layout

Assembly: **Xui.Core** · [C# declarations](index.cs) · [Assembly overview](../index.md)

## Types

- [`class FlexBox`](#api-5a54224168817076)
- [`enum FlexBox.AlignContent`](#api-19dbf5a8eb3b379e)
- [`enum FlexBox.AlignItems`](#api-6d1565c369328915)
- [`enum FlexBox.Direction`](#api-16fffc7595e689d5)
- [`enum FlexBox.JustifyContent`](#api-a838c3356e4cf8b6)
- [`enum FlexBox.Wrap`](#api-9e7c721fab0826cb)
- [`class Grid`](#api-871b8969ae5a113d)
- [`enum Grid.AlignContent`](#api-2dc21c5ee7fc8b7d)
- [`enum Grid.AlignItems`](#api-66d6bc66aeda71ff)
- [`enum Grid.AutoFlow`](#api-430c73d30606ead3)
- [`enum Grid.JustifyContent`](#api-9d0ed0d61d499e4d)
- [`enum Grid.JustifyItems`](#api-33cae9fcb51d3079)
- [`readonly struct Grid.TrackSize`](#api-ddf1ae49081f845a)
- [`enum Grid.TrackSizeKind`](#api-44d308c10c0d9352)

<a id="api-5a54224168817076"></a>

## `class FlexBox`

A container view that arranges children along a main axis with flexible sizing and wrapping. Container-level properties mirror the CSS Flex Box spec.

Supports row/column layout, wrapping, order, gaps, flexible sizing, and space distribution. Item baseline alignment currently falls back to cross-axis start; line baseline alignment falls back to start. Views do not yet expose a common layout-baseline contract.

```csharp
public partial class FlexBox
{
    public enum AlignContent : byte
    {
        Normal = 0,
        FlexStart = 1,
        FlexEnd = 2,
        Center = 3,
        SpaceBetween = 4,
        SpaceAround = 5,
        SpaceEvenly = 6,
        Stretch = 7,
        FirstBaseline = 8,
        LastBaseline = 9,
    }
}
public partial class FlexBox
{
    public enum AlignItems : byte
    {
        Normal = 0,
        Stretch = 1,
        FlexStart = 2,
        FlexEnd = 3,
        Center = 4,
        Baseline = 5,
        FirstBaseline = 6,
        LastBaseline = 7,
    }
}
public partial class FlexBox
{
    public new enum Direction : byte
    {
        Row = 0,
        RowReverse = 1,
        Column = 2,
        ColumnReverse = 3,
    }
}
public partial class FlexBox
{
    public static readonly View.Extra<nint> Order;
    public static readonly View.Extra<nfloat> Grow;
    public static readonly View.Extra<nfloat> Shrink;
    public static readonly View.Extra<nfloat> Basis;
}
public partial class FlexBox
{
    public enum JustifyContent : byte
    {
        Normal = 0,
        FlexStart = 1,
        FlexEnd = 2,
        Center = 3,
        SpaceBetween = 4,
        SpaceAround = 5,
        SpaceEvenly = 6,
        Start = 7,
        End = 8,
    }
}
public partial class FlexBox
{
    protected override Size MeasureCore(Size available, IMeasureContext context);
    protected override void ArrangeCore(Rect rect, IMeasureContext context);
}
public partial class FlexBox
{
    public enum Wrap : byte
    {
        NoWrap = 0,
        Wrap = 1,
        WrapReverse = 2,
    }
}
public partial class FlexBox : ViewCollection
{
    public Direction FlexDirection { get; set; }
    public Wrap FlexWrap { get; set; }
    public JustifyContent FlexJustifyContent { get; set; }
    public AlignItems FlexAlignItems { get; set; }
    public AlignContent FlexAlignContent { get; set; }
    public nfloat RowGap { get; set; }
    public nfloat ColumnGap { get; set; }
}
```

<a id="api-5112e4be7d64b88f"></a>

### [`void FlexBox.ArrangeCore(Rect rect, IMeasureContext context)`](#api-5112e4be7d64b88f)


```csharp
protected override void ArrangeCore(Rect rect, IMeasureContext context);
```

Override to arrange children within this view&#39;s final frame.

<a id="api-416620cefe0cecda"></a>

### [`Extra<NFloat> FlexBox.Basis`](#api-416620cefe0cecda)


```csharp
public static readonly View.Extra<nfloat> Basis;
```

The initial size of the item along the main axis before free space is distributed. `nfloat.NaN` means `auto` (use the item&#39;s width or height). Corresponds to CSS `flex-basis`.

<a id="api-453988e0bc595a85"></a>

### [`NFloat FlexBox.ColumnGap`](#api-453988e0bc595a85)


```csharp
public nfloat ColumnGap { get; set; }
```

Space between columns of flex items. Corresponds to `column-gap`. Default is `0`.

<a id="api-19f303a65e154893"></a>

### [`AlignContent FlexBox.FlexAlignContent`](#api-19f303a65e154893)


```csharp
public AlignContent FlexAlignContent { get; set; }
```

Aligns flex lines along the cross axis when there is extra space (only applies when wrapping). Corresponds to `align-content`. Default is [`Xui.Core.UI.Layout.FlexBox.AlignContent.Normal`](../xui-core-ui-layout/index.md#api-3ae61f67838a423f).

<a id="api-659f2ec8bb801f49"></a>

### [`AlignItems FlexBox.FlexAlignItems`](#api-659f2ec8bb801f49)


```csharp
public AlignItems FlexAlignItems { get; set; }
```

Sets the default cross-axis alignment for all flex items on a line. Corresponds to `align-items`. Default is [`Xui.Core.UI.Layout.FlexBox.AlignItems.Stretch`](../xui-core-ui-layout/index.md#api-692dadc937de8d59).

<a id="api-f5e13472225977f6"></a>

### [`Direction FlexBox.FlexDirection`](#api-f5e13472225977f6)


```csharp
public Direction FlexDirection { get; set; }
```

Sets the main axis direction along which flex items are placed. Corresponds to `flex-direction`. Default is [`Xui.Core.UI.Layout.FlexBox.Direction.Row`](../xui-core-ui-layout/index.md#api-d08d9977be424db0).

<a id="api-8b7b9f1de194caf2"></a>

### [`JustifyContent FlexBox.FlexJustifyContent`](#api-8b7b9f1de194caf2)


```csharp
public JustifyContent FlexJustifyContent { get; set; }
```

Aligns flex items along the main axis when there is free space. Corresponds to `justify-content`. Default is [`Xui.Core.UI.Layout.FlexBox.JustifyContent.FlexStart`](../xui-core-ui-layout/index.md#api-c9687e565bff2728).

<a id="api-cccf7b68fa51cd3e"></a>

### [`Wrap FlexBox.FlexWrap`](#api-cccf7b68fa51cd3e)


```csharp
public Wrap FlexWrap { get; set; }
```

Controls whether flex items wrap onto multiple lines. Corresponds to `flex-wrap`. Default is [`Xui.Core.UI.Layout.FlexBox.Wrap.NoWrap`](../xui-core-ui-layout/index.md#api-e607431f30a1a2a3).

<a id="api-066f82a30ef85c35"></a>

### [`Extra<NFloat> FlexBox.Grow`](#api-066f82a30ef85c35)


```csharp
public static readonly View.Extra<nfloat> Grow;
```

How much the item will grow relative to other flex items when free space is available. Corresponds to CSS `flex-grow`. Default is `0` (does not grow).

<a id="api-73ae445ca5ae82f1"></a>

### [`Size FlexBox.MeasureCore(Size available, IMeasureContext context)`](#api-73ae445ca5ae82f1)


```csharp
protected override Size MeasureCore(Size available, IMeasureContext context);
```

Override to compute the desired border-edge size.

<a id="api-175b24b2530504c7"></a>

### [`Extra<nint> FlexBox.Order`](#api-175b24b2530504c7)


```csharp
public static readonly View.Extra<nint> Order;
```

Controls the order in which the item appears within the flex container, overriding source order. Corresponds to CSS `order`.

<a id="api-3e65e6a811926e08"></a>

### [`NFloat FlexBox.RowGap`](#api-3e65e6a811926e08)


```csharp
public nfloat RowGap { get; set; }
```

Space between rows of flex items. Corresponds to `row-gap`. Default is `0`.

<a id="api-4eebb0a3c14c6a0a"></a>

### [`Extra<NFloat> FlexBox.Shrink`](#api-4eebb0a3c14c6a0a)


```csharp
public static readonly View.Extra<nfloat> Shrink;
```

How much the item will shrink relative to other flex items when space is insufficient. Corresponds to CSS `flex-shrink`. Default is `1` (shrinks evenly).


<a id="api-19dbf5a8eb3b379e"></a>

## `enum FlexBox.AlignContent`

Aligns flex lines along the cross axis when there is extra space (only applies when wrapping). Corresponds to the CSS `align-content` property on a flex container.

```csharp
public enum AlignContent : byte
{
    Normal = 0,
    FlexStart = 1,
    FlexEnd = 2,
    Center = 3,
    SpaceBetween = 4,
    SpaceAround = 5,
    SpaceEvenly = 6,
    Stretch = 7,
    FirstBaseline = 8,
    LastBaseline = 9,
}
```

<a id="api-3084070affdf5a77"></a>

### [`AlignContent.Center`](#api-3084070affdf5a77)


```csharp
Center = 3
```

Lines are centered on the cross axis.

<a id="api-43a2192d68084dd2"></a>

### [`AlignContent.FirstBaseline`](#api-43a2192d68084dd2)


```csharp
FirstBaseline = 8
```

Lines are aligned along their first baseline.

<a id="api-abefeac2ea328e50"></a>

### [`AlignContent.FlexEnd`](#api-abefeac2ea328e50)


```csharp
FlexEnd = 2
```

Lines are packed toward the flex-end edge of the cross axis.

<a id="api-4ceb3e51005e35d0"></a>

### [`AlignContent.FlexStart`](#api-4ceb3e51005e35d0)


```csharp
FlexStart = 1
```

Lines are packed toward the flex-start edge of the cross axis.

<a id="api-8959729b1ee7a56b"></a>

### [`AlignContent.LastBaseline`](#api-8959729b1ee7a56b)


```csharp
LastBaseline = 9
```

Lines are aligned along their last baseline.

<a id="api-3ae61f67838a423f"></a>

### [`AlignContent.Normal`](#api-3ae61f67838a423f)


```csharp
Normal = 0
```

Browser default. Acts like [`Xui.Core.UI.Layout.FlexBox.AlignContent.Stretch`](../xui-core-ui-layout/index.md#api-88c3bb110fa38b93).

<a id="api-c2d47c0042798f13"></a>

### [`AlignContent.SpaceAround`](#api-c2d47c0042798f13)


```csharp
SpaceAround = 5
```

Lines are evenly distributed with equal space around each line.

<a id="api-a1203920d9bc5905"></a>

### [`AlignContent.SpaceBetween`](#api-a1203920d9bc5905)


```csharp
SpaceBetween = 4
```

Lines are evenly distributed; first line at start, last at end.

<a id="api-977cb220c5f38a78"></a>

### [`AlignContent.SpaceEvenly`](#api-977cb220c5f38a78)


```csharp
SpaceEvenly = 6
```

Lines are evenly distributed with equal space between all lines including edges.

<a id="api-88c3bb110fa38b93"></a>

### [`AlignContent.Stretch`](#api-88c3bb110fa38b93)


```csharp
Stretch = 7
```

Lines are stretched to fill the container.


<a id="api-6d1565c369328915"></a>

## `enum FlexBox.AlignItems`

Sets the default cross-axis alignment for all flex items on a line. Corresponds to the CSS `align-items` property on a flex container.

```csharp
public enum AlignItems : byte
{
    Normal = 0,
    Stretch = 1,
    FlexStart = 2,
    FlexEnd = 3,
    Center = 4,
    Baseline = 5,
    FirstBaseline = 6,
    LastBaseline = 7,
}
```

<a id="api-2cb60e5b75337bb2"></a>

### [`AlignItems.Baseline`](#api-2cb60e5b75337bb2)


```csharp
Baseline = 5
```

Items are aligned along their first baseline.

<a id="api-9660bd86fe070549"></a>

### [`AlignItems.Center`](#api-9660bd86fe070549)


```csharp
Center = 4
```

Items are centered on the cross axis.

<a id="api-3d3dc3ad3d42b484"></a>

### [`AlignItems.FirstBaseline`](#api-3d3dc3ad3d42b484)


```csharp
FirstBaseline = 6
```

Items are aligned along their first baseline (same as [`Xui.Core.UI.Layout.FlexBox.AlignItems.Baseline`](../xui-core-ui-layout/index.md#api-2cb60e5b75337bb2)).

<a id="api-57d9206af83960c4"></a>

### [`AlignItems.FlexEnd`](#api-57d9206af83960c4)


```csharp
FlexEnd = 3
```

Items are packed toward the flex-end edge of the cross axis.

<a id="api-5e77bafb71f6f952"></a>

### [`AlignItems.FlexStart`](#api-5e77bafb71f6f952)


```csharp
FlexStart = 2
```

Items are packed toward the flex-start edge of the cross axis.

<a id="api-fbba3843366a4d8d"></a>

### [`AlignItems.LastBaseline`](#api-fbba3843366a4d8d)


```csharp
LastBaseline = 7
```

Items are aligned along their last baseline.

<a id="api-8612b20e3fa430f3"></a>

### [`AlignItems.Normal`](#api-8612b20e3fa430f3)


```csharp
Normal = 0
```

Browser default. Acts like [`Xui.Core.UI.Layout.FlexBox.AlignItems.Stretch`](../xui-core-ui-layout/index.md#api-692dadc937de8d59).

<a id="api-692dadc937de8d59"></a>

### [`AlignItems.Stretch`](#api-692dadc937de8d59)


```csharp
Stretch = 1
```

Items are stretched to fill the cross axis.


<a id="api-16fffc7595e689d5"></a>

## `enum FlexBox.Direction`

Specifies the direction of the main axis along which flex items are placed. Corresponds to the CSS `flex-direction` property.

```csharp
public new enum Direction : byte
{
    Row = 0,
    RowReverse = 1,
    Column = 2,
    ColumnReverse = 3,
}
```

<a id="api-6f4f0f89447ef266"></a>

### [`Direction.Column`](#api-6f4f0f89447ef266)


```csharp
Column = 2
```

Items are placed top to bottom (block-start to block-end).

<a id="api-febbbfdfff1c1770"></a>

### [`Direction.ColumnReverse`](#api-febbbfdfff1c1770)


```csharp
ColumnReverse = 3
```

Items are placed bottom to top (block-end to block-start).

<a id="api-d08d9977be424db0"></a>

### [`Direction.Row`](#api-d08d9977be424db0)


```csharp
Row = 0
```

Items are placed left to right (inline-start to inline-end).

<a id="api-04a2f0e434a472da"></a>

### [`Direction.RowReverse`](#api-04a2f0e434a472da)


```csharp
RowReverse = 1
```

Items are placed right to left (inline-end to inline-start).


<a id="api-a838c3356e4cf8b6"></a>

## `enum FlexBox.JustifyContent`

Aligns flex items along the main axis when there is free space. Corresponds to the CSS `justify-content` property on a flex container.

```csharp
public enum JustifyContent : byte
{
    Normal = 0,
    FlexStart = 1,
    FlexEnd = 2,
    Center = 3,
    SpaceBetween = 4,
    SpaceAround = 5,
    SpaceEvenly = 6,
    Start = 7,
    End = 8,
}
```

<a id="api-02ac6c3343480d69"></a>

### [`JustifyContent.Center`](#api-02ac6c3343480d69)


```csharp
Center = 3
```

Items are centered along the main axis.

<a id="api-00319d954da62c47"></a>

### [`JustifyContent.End`](#api-00319d954da62c47)


```csharp
End = 8
```

Items are packed toward the end of the main axis.

<a id="api-4e6840f6ce6529b6"></a>

### [`JustifyContent.FlexEnd`](#api-4e6840f6ce6529b6)


```csharp
FlexEnd = 2
```

Items are packed toward the flex-end edge of the main axis.

<a id="api-c9687e565bff2728"></a>

### [`JustifyContent.FlexStart`](#api-c9687e565bff2728)


```csharp
FlexStart = 1
```

Items are packed toward the flex-start edge of the main axis.

<a id="api-9bd184d779355e55"></a>

### [`JustifyContent.Normal`](#api-9bd184d779355e55)


```csharp
Normal = 0
```

Browser default. Acts like [`Xui.Core.UI.Layout.FlexBox.JustifyContent.FlexStart`](../xui-core-ui-layout/index.md#api-c9687e565bff2728).

<a id="api-66b0c8e80678f39f"></a>

### [`JustifyContent.SpaceAround`](#api-66b0c8e80678f39f)


```csharp
SpaceAround = 5
```

Items are evenly distributed with equal space around each item.

<a id="api-5879dce55eb54426"></a>

### [`JustifyContent.SpaceBetween`](#api-5879dce55eb54426)


```csharp
SpaceBetween = 4
```

Items are evenly distributed; first item at start, last at end.

<a id="api-6fcb87660a9a68ce"></a>

### [`JustifyContent.SpaceEvenly`](#api-6fcb87660a9a68ce)


```csharp
SpaceEvenly = 6
```

Items are evenly distributed with equal space between all items including edges.

<a id="api-c394dbd166fdbb63"></a>

### [`JustifyContent.Start`](#api-c394dbd166fdbb63)


```csharp
Start = 7
```

Items are packed toward the start of the main axis.


<a id="api-9e7c721fab0826cb"></a>

## `enum FlexBox.Wrap`

Controls whether flex items are forced onto a single line or can wrap onto multiple lines. Corresponds to the CSS `flex-wrap` property.

```csharp
public enum Wrap : byte
{
    NoWrap = 0,
    Wrap = 1,
    WrapReverse = 2,
}
```

<a id="api-e607431f30a1a2a3"></a>

### [`Wrap.NoWrap`](#api-e607431f30a1a2a3)


```csharp
NoWrap = 0
```

All flex items are on a single line.

<a id="api-f0a1f2446a502065"></a>

### [`Wrap.Wrap`](#api-f0a1f2446a502065)


```csharp
Wrap = 1
```

Flex items wrap onto additional lines in the block-start direction.

<a id="api-355b48aa7956d400"></a>

### [`Wrap.WrapReverse`](#api-355b48aa7956d400)


```csharp
WrapReverse = 2
```

Flex items wrap onto additional lines in the block-end direction.


<a id="api-871b8969ae5a113d"></a>

## `class Grid`

A container view that arranges children in a grid of rows and columns. Container-level properties mirror the CSS Grid spec.

CSS Grid Layout implementation for the Grid container. Provides MeasureCore and ArrangeCore implementations following the CSS Grid Layout Module Level 1 specification.

Implementation notes:



- Track sizing supports: Length, Auto, MinContent, MaxContent, Fr (fractional units), MinMax, and FitContent
- Auto-placement follows grid-auto-flow (row or column direction)
- Named grid areas are parsed from TemplateAreas
- Gaps are applied between tracks
- Alignment is supported via justify-items, align-items, justify-content, align-content
- Child positioning via grid-row-start/end, grid-column-start/end, and grid-area



Algorithm approach:



- Build grid structure: parse areas, determine placement for each child
- Measure tracks: resolve fixed sizes, content-based sizes, then distribute fr units
- Arrange children: position each child in its grid area with alignment

```csharp
public partial class Grid
{
    public enum AlignContent : byte
    {
        Normal = 0,
        Start = 1,
        End = 2,
        Center = 3,
        SpaceBetween = 4,
        SpaceAround = 5,
        SpaceEvenly = 6,
        Stretch = 7,
        FirstBaseline = 8,
        LastBaseline = 9,
    }
}
public partial class Grid
{
    public enum AlignItems : byte
    {
        Normal = 0,
        Stretch = 1,
        Start = 2,
        End = 3,
        Center = 4,
        Baseline = 5,
        FirstBaseline = 6,
        LastBaseline = 7,
    }
}
public partial class Grid
{
    public enum AutoFlow : byte
    {
        Row = 0,
        Column = 1,
        RowDense = 2,
        ColumnDense = 3,
    }
}
public partial class Grid
{
    public static readonly View.Extra<nint> RowStart;
    public static readonly View.Extra<nint> RowEnd;
    public static readonly View.Extra<nint> ColumnStart;
    public static readonly View.Extra<nint> ColumnEnd;
    public static readonly View.Extra<string?> Area;
    public static readonly View.Extra<nint> Order;
    public static readonly View.Extra<nint> RowSpan;
    public static readonly View.Extra<nint> ColumnSpan;
}
public partial class Grid
{
    public enum JustifyContent : byte
    {
        Normal = 0,
        Start = 1,
        End = 2,
        Center = 3,
        Left = 4,
        Right = 5,
        SpaceBetween = 6,
        SpaceAround = 7,
        SpaceEvenly = 8,
        Stretch = 9,
    }
}
public partial class Grid
{
    public enum JustifyItems : byte
    {
        Normal = 0,
        Stretch = 1,
        Start = 2,
        End = 3,
        Center = 4,
        Left = 5,
        Right = 6,
        Baseline = 7,
        FirstBaseline = 8,
        LastBaseline = 9,
    }
}
public partial class Grid
{
    protected override Size MeasureCore(Size availableBorderEdgeSize, IMeasureContext context);
    protected override void ArrangeCore(Rect rect, IMeasureContext context);
}
public partial class Grid
{
    public readonly struct TrackSize
    {
        public TrackSizeKind Kind { get; }
        public nfloat Value { get; }
        public nfloat MinValue { get; }
        public nfloat MaxValue { get; }

        public static readonly TrackSize Auto;
        public static readonly TrackSize MinContent;
        public static readonly TrackSize MaxContent;
        public static TrackSize Px(nfloat px);
        public static TrackSize Fr(nfloat fr);
        public static TrackSize MinMax(nfloat min, nfloat max);
        public static TrackSize FitContent(nfloat max);
        public static implicit operator TrackSize(nfloat px);
        public static implicit operator TrackSize(float px);
        public static implicit operator TrackSize(double px);
        public static implicit operator TrackSize(int px);
        public override string ToString();
    }

    public enum TrackSizeKind : byte
    {
        Auto = 0,
        MinContent = 1,
        MaxContent = 2,
        Length = 3,
        Fr = 4,
        MinMax = 5,
        FitContent = 6,
    }
}
public partial class Grid : ViewCollection
{
    public TrackSize[] TemplateColumns { get; set; }
    public TrackSize[] TemplateRows { get; set; }
    public string[] TemplateAreas { get; set; }
    public TrackSize AutoColumns { get; set; }
    public TrackSize AutoRows { get; set; }
    public AutoFlow GridAutoFlow { get; set; }
    public JustifyItems GridJustifyItems { get; set; }
    public AlignItems GridAlignItems { get; set; }
    public JustifyContent GridJustifyContent { get; set; }
    public AlignContent GridAlignContent { get; set; }
    public nfloat RowGap { get; set; }
    public nfloat ColumnGap { get; set; }
}
```

<a id="api-82408c0c08ca6050"></a>

### [`Extra<string?> Grid.Area`](#api-82408c0c08ca6050)


```csharp
public static readonly View.Extra<string?> Area;
```

Places the item into a named grid area defined by [`Xui.Core.UI.Layout.Grid.TemplateAreas`](../xui-core-ui-layout/index.md#api-98b7f66d17193268). Corresponds to CSS `grid-area`.

<a id="api-3739518e9d369d5b"></a>

### [`void Grid.ArrangeCore(Rect rect, IMeasureContext context)`](#api-3739518e9d369d5b)


```csharp
protected override void ArrangeCore(Rect rect, IMeasureContext context);
```

Override to arrange children within this view&#39;s final frame.

<a id="api-ca764ebe200786b9"></a>

### [`TrackSize Grid.AutoColumns`](#api-ca764ebe200786b9)


```csharp
public TrackSize AutoColumns { get; set; }
```

Sizing for implicitly created columns (those outside [`Xui.Core.UI.Layout.Grid.TemplateColumns`](../xui-core-ui-layout/index.md#api-ec284ba055cd2fcb)). Corresponds to `grid-auto-columns`. Default is [`Xui.Core.UI.Layout.Grid.TrackSize.Auto`](../xui-core-ui-layout/index.md#api-c55d1e989f312d10).

<a id="api-72782822fb033d66"></a>

### [`TrackSize Grid.AutoRows`](#api-72782822fb033d66)


```csharp
public TrackSize AutoRows { get; set; }
```

Sizing for implicitly created rows (those outside [`Xui.Core.UI.Layout.Grid.TemplateRows`](../xui-core-ui-layout/index.md#api-541e78c315f3032d)). Corresponds to `grid-auto-rows`. Default is [`Xui.Core.UI.Layout.Grid.TrackSize.Auto`](../xui-core-ui-layout/index.md#api-c55d1e989f312d10).

<a id="api-213b8ba260c8870f"></a>

### [`Extra<nint> Grid.ColumnEnd`](#api-213b8ba260c8870f)


```csharp
public static readonly View.Extra<nint> ColumnEnd;
```

The grid line where the item&#39;s column ends (1-indexed, exclusive). `0` means `auto`. Corresponds to CSS `grid-column-end`.

<a id="api-fe2404be701902bf"></a>

### [`NFloat Grid.ColumnGap`](#api-fe2404be701902bf)


```csharp
public nfloat ColumnGap { get; set; }
```

Space between grid columns. Corresponds to `column-gap`. Default is `0`.

<a id="api-ee5c806fb57c1d89"></a>

### [`Extra<nint> Grid.ColumnSpan`](#api-ee5c806fb57c1d89)


```csharp
public static readonly View.Extra<nint> ColumnSpan;
```

The number of columns the item spans. Shorthand for setting [`Xui.Core.UI.Layout.Grid.ColumnEnd`](../xui-core-ui-layout/index.md#api-213b8ba260c8870f) = [`Xui.Core.UI.Layout.Grid.ColumnStart`](../xui-core-ui-layout/index.md#api-8ad885d506721fa3) + ColumnSpan.

<a id="api-8ad885d506721fa3"></a>

### [`Extra<nint> Grid.ColumnStart`](#api-8ad885d506721fa3)


```csharp
public static readonly View.Extra<nint> ColumnStart;
```

The grid line where the item&#39;s column starts (1-indexed). `0` means `auto`. Corresponds to CSS `grid-column-start`.

<a id="api-ef61ded215bb163a"></a>

### [`AlignContent Grid.GridAlignContent`](#api-ef61ded215bb163a)


```csharp
public AlignContent GridAlignContent { get; set; }
```

Aligns the grid along the block axis within the container when the grid is smaller than the container. Corresponds to `align-content`. Default is [`Xui.Core.UI.Layout.Grid.AlignContent.Start`](../xui-core-ui-layout/index.md#api-4992459925614e39).

<a id="api-766b381140a73fc0"></a>

### [`AlignItems Grid.GridAlignItems`](#api-766b381140a73fc0)


```csharp
public AlignItems GridAlignItems { get; set; }
```

Sets the default block-axis alignment for all grid items within their grid areas. Corresponds to `align-items`. Default is [`Xui.Core.UI.Layout.Grid.AlignItems.Stretch`](../xui-core-ui-layout/index.md#api-e9e930e21ec7f936).

<a id="api-f90e1cbaa2afe739"></a>

### [`AutoFlow Grid.GridAutoFlow`](#api-f90e1cbaa2afe739)


```csharp
public AutoFlow GridAutoFlow { get; set; }
```

Controls how auto-placed items flow into the grid. Corresponds to `grid-auto-flow`. Default is [`Xui.Core.UI.Layout.Grid.AutoFlow.Row`](../xui-core-ui-layout/index.md#api-886550177b8e72a1).

<a id="api-50ec2a768653f45e"></a>

### [`JustifyContent Grid.GridJustifyContent`](#api-50ec2a768653f45e)


```csharp
public JustifyContent GridJustifyContent { get; set; }
```

Aligns the grid along the inline axis within the container when the grid is smaller than the container. Corresponds to `justify-content`. Default is [`Xui.Core.UI.Layout.Grid.JustifyContent.Start`](../xui-core-ui-layout/index.md#api-fca7320fce79fe95).

<a id="api-1e105f117eee2b8c"></a>

### [`JustifyItems Grid.GridJustifyItems`](#api-1e105f117eee2b8c)


```csharp
public JustifyItems GridJustifyItems { get; set; }
```

Sets the default inline-axis alignment for all grid items within their grid areas. Corresponds to `justify-items`. Default is [`Xui.Core.UI.Layout.Grid.JustifyItems.Stretch`](../xui-core-ui-layout/index.md#api-c9b4faaf8ead5b70).

<a id="api-451bd53e568f8e8b"></a>

### [`Size Grid.MeasureCore(Size availableBorderEdgeSize, IMeasureContext context)`](#api-451bd53e568f8e8b)


```csharp
protected override Size MeasureCore(Size availableBorderEdgeSize, IMeasureContext context);
```

Override to compute the desired border-edge size.

<a id="api-41d6d3a6f38cfa29"></a>

### [`Extra<nint> Grid.Order`](#api-41d6d3a6f38cfa29)


```csharp
public static readonly View.Extra<nint> Order;
```

Controls the order in which the item appears within the grid, overriding source order. Corresponds to CSS `order`.

<a id="api-14c3a7c28f1dd57d"></a>

### [`Extra<nint> Grid.RowEnd`](#api-14c3a7c28f1dd57d)


```csharp
public static readonly View.Extra<nint> RowEnd;
```

The grid line where the item&#39;s row ends (1-indexed, exclusive). `0` means `auto`. Corresponds to CSS `grid-row-end`.

<a id="api-7388e24ba6fb4d4b"></a>

### [`NFloat Grid.RowGap`](#api-7388e24ba6fb4d4b)


```csharp
public nfloat RowGap { get; set; }
```

Space between grid rows. Corresponds to `row-gap`. Default is `0`.

<a id="api-e83079fc72770464"></a>

### [`Extra<nint> Grid.RowSpan`](#api-e83079fc72770464)


```csharp
public static readonly View.Extra<nint> RowSpan;
```

The number of rows the item spans. Shorthand for setting [`Xui.Core.UI.Layout.Grid.RowEnd`](../xui-core-ui-layout/index.md#api-14c3a7c28f1dd57d) = [`Xui.Core.UI.Layout.Grid.RowStart`](../xui-core-ui-layout/index.md#api-9e6f5cef243ca049) + RowSpan.

<a id="api-9e6f5cef243ca049"></a>

### [`Extra<nint> Grid.RowStart`](#api-9e6f5cef243ca049)


```csharp
public static readonly View.Extra<nint> RowStart;
```

The grid line where the item&#39;s row starts (1-indexed). `0` means `auto`. Corresponds to CSS `grid-row-start`.

<a id="api-98b7f66d17193268"></a>

### [`string[] Grid.TemplateAreas`](#api-98b7f66d17193268)


```csharp
public string[] TemplateAreas { get; set; }
```

Defines named grid areas. Each string in the array defines one row; space-separated cell names define columns within that row. A dot (`.`) denotes an unnamed cell. Corresponds to `grid-template-areas`. Default is an empty array.

<a id="api-ec284ba055cd2fcb"></a>

### [`TrackSize[] Grid.TemplateColumns`](#api-ec284ba055cd2fcb)


```csharp
public TrackSize[] TemplateColumns { get; set; }
```

Defines the track sizes for explicitly defined columns. Corresponds to `grid-template-columns`. Default is an empty array (no explicit columns).

<a id="api-541e78c315f3032d"></a>

### [`TrackSize[] Grid.TemplateRows`](#api-541e78c315f3032d)


```csharp
public TrackSize[] TemplateRows { get; set; }
```

Defines the track sizes for explicitly defined rows. Corresponds to `grid-template-rows`. Default is an empty array (no explicit rows).


<a id="api-2dc21c5ee7fc8b7d"></a>

## `enum Grid.AlignContent`

Aligns the grid along the block axis within the container when the grid is smaller than the container. Corresponds to the CSS `align-content` property on a grid container.

```csharp
public enum AlignContent : byte
{
    Normal = 0,
    Start = 1,
    End = 2,
    Center = 3,
    SpaceBetween = 4,
    SpaceAround = 5,
    SpaceEvenly = 6,
    Stretch = 7,
    FirstBaseline = 8,
    LastBaseline = 9,
}
```

<a id="api-c65994e45b5f0613"></a>

### [`AlignContent.Center`](#api-c65994e45b5f0613)


```csharp
Center = 3
```

Rows are centered on the block axis.

<a id="api-4b8caa20c2b4463b"></a>

### [`AlignContent.End`](#api-4b8caa20c2b4463b)


```csharp
End = 2
```

Rows are packed toward the end of the block axis.

<a id="api-c9ceeaf7a4e6bb27"></a>

### [`AlignContent.FirstBaseline`](#api-c9ceeaf7a4e6bb27)


```csharp
FirstBaseline = 8
```

Rows are aligned along their first baseline.

<a id="api-cbc05573f61c0342"></a>

### [`AlignContent.LastBaseline`](#api-cbc05573f61c0342)


```csharp
LastBaseline = 9
```

Rows are aligned along their last baseline.

<a id="api-6f0b140b17ee9d47"></a>

### [`AlignContent.Normal`](#api-6f0b140b17ee9d47)


```csharp
Normal = 0
```

Browser default. Acts like [`Xui.Core.UI.Layout.Grid.AlignContent.Stretch`](../xui-core-ui-layout/index.md#api-02990f095c4d6569).

<a id="api-33eede11e01fc9aa"></a>

### [`AlignContent.SpaceAround`](#api-33eede11e01fc9aa)


```csharp
SpaceAround = 5
```

Rows are evenly distributed with equal space around each row.

<a id="api-e42a1b30348d7962"></a>

### [`AlignContent.SpaceBetween`](#api-e42a1b30348d7962)


```csharp
SpaceBetween = 4
```

Rows are evenly distributed; first row at start, last at end.

<a id="api-a3dad6973f16a1fc"></a>

### [`AlignContent.SpaceEvenly`](#api-a3dad6973f16a1fc)


```csharp
SpaceEvenly = 6
```

Rows are evenly distributed with equal space between all rows including edges.

<a id="api-4992459925614e39"></a>

### [`AlignContent.Start`](#api-4992459925614e39)


```csharp
Start = 1
```

Rows are packed toward the start of the block axis.

<a id="api-02990f095c4d6569"></a>

### [`AlignContent.Stretch`](#api-02990f095c4d6569)


```csharp
Stretch = 7
```

Rows are stretched to fill the container block size.


<a id="api-66d6bc66aeda71ff"></a>

## `enum Grid.AlignItems`

Sets the default block-axis alignment for all grid items within their grid areas. Corresponds to the CSS `align-items` property on a grid container.

```csharp
public enum AlignItems : byte
{
    Normal = 0,
    Stretch = 1,
    Start = 2,
    End = 3,
    Center = 4,
    Baseline = 5,
    FirstBaseline = 6,
    LastBaseline = 7,
}
```

<a id="api-b83c3d958d6cd07a"></a>

### [`AlignItems.Baseline`](#api-b83c3d958d6cd07a)


```csharp
Baseline = 5
```

Items are aligned along their first baseline.

<a id="api-d5702302ecad93a7"></a>

### [`AlignItems.Center`](#api-d5702302ecad93a7)


```csharp
Center = 4
```

Items are centered on the block axis.

<a id="api-76dd976538f411b4"></a>

### [`AlignItems.End`](#api-76dd976538f411b4)


```csharp
End = 3
```

Items are packed toward the end of the block axis.

<a id="api-dbeef6645b2b3d99"></a>

### [`AlignItems.FirstBaseline`](#api-dbeef6645b2b3d99)


```csharp
FirstBaseline = 6
```

Items are aligned along their first baseline (same as [`Xui.Core.UI.Layout.Grid.AlignItems.Baseline`](../xui-core-ui-layout/index.md#api-b83c3d958d6cd07a)).

<a id="api-b91e8a73c41bc0e5"></a>

### [`AlignItems.LastBaseline`](#api-b91e8a73c41bc0e5)


```csharp
LastBaseline = 7
```

Items are aligned along their last baseline.

<a id="api-78a6e2cac8f77b28"></a>

### [`AlignItems.Normal`](#api-78a6e2cac8f77b28)


```csharp
Normal = 0
```

Browser default. Acts like [`Xui.Core.UI.Layout.Grid.AlignItems.Stretch`](../xui-core-ui-layout/index.md#api-e9e930e21ec7f936).

<a id="api-59c1a9082ee41bba"></a>

### [`AlignItems.Start`](#api-59c1a9082ee41bba)


```csharp
Start = 2
```

Items are packed toward the start of the block axis.

<a id="api-e9e930e21ec7f936"></a>

### [`AlignItems.Stretch`](#api-e9e930e21ec7f936)


```csharp
Stretch = 1
```

Items are stretched to fill the grid area block size.


<a id="api-430c73d30606ead3"></a>

## `enum Grid.AutoFlow`

Controls how auto-placed items are inserted into the grid. Corresponds to the CSS `grid-auto-flow` property.

```csharp
public enum AutoFlow : byte
{
    Row = 0,
    Column = 1,
    RowDense = 2,
    ColumnDense = 3,
}
```

<a id="api-a46b9e759daacaf1"></a>

### [`AutoFlow.Column`](#api-a46b9e759daacaf1)


```csharp
Column = 1
```

Auto-placed items fill each column in turn, adding new columns as needed.

<a id="api-cc27aa4b3141fcfc"></a>

### [`AutoFlow.ColumnDense`](#api-cc27aa4b3141fcfc)


```csharp
ColumnDense = 3
```

Auto-placed items fill each column, using a dense packing algorithm that attempts to fill in holes earlier in the grid.

<a id="api-886550177b8e72a1"></a>

### [`AutoFlow.Row`](#api-886550177b8e72a1)


```csharp
Row = 0
```

Auto-placed items fill each row in turn, adding new rows as needed.

<a id="api-ddd5b32189432627"></a>

### [`AutoFlow.RowDense`](#api-ddd5b32189432627)


```csharp
RowDense = 2
```

Auto-placed items fill each row, using a dense packing algorithm that attempts to fill in holes earlier in the grid.


<a id="api-9d0ed0d61d499e4d"></a>

## `enum Grid.JustifyContent`

Aligns the grid along the inline axis within the container when the grid is smaller than the container. Corresponds to the CSS `justify-content` property on a grid container.

```csharp
public enum JustifyContent : byte
{
    Normal = 0,
    Start = 1,
    End = 2,
    Center = 3,
    Left = 4,
    Right = 5,
    SpaceBetween = 6,
    SpaceAround = 7,
    SpaceEvenly = 8,
    Stretch = 9,
}
```

<a id="api-a7b1af44e208655b"></a>

### [`JustifyContent.Center`](#api-a7b1af44e208655b)


```csharp
Center = 3
```

Grid is centered along the inline axis.

<a id="api-202a13c6b20fbc48"></a>

### [`JustifyContent.End`](#api-202a13c6b20fbc48)


```csharp
End = 2
```

Grid is packed toward the end of the inline axis.

<a id="api-e4b5aa80b8b16df3"></a>

### [`JustifyContent.Left`](#api-e4b5aa80b8b16df3)


```csharp
Left = 4
```

Grid is packed toward the left end of the inline axis.

<a id="api-202aa93d318b68eb"></a>

### [`JustifyContent.Normal`](#api-202aa93d318b68eb)


```csharp
Normal = 0
```

Browser default. Acts like [`Xui.Core.UI.Layout.Grid.JustifyContent.Start`](../xui-core-ui-layout/index.md#api-fca7320fce79fe95).

<a id="api-3e70e49861610135"></a>

### [`JustifyContent.Right`](#api-3e70e49861610135)


```csharp
Right = 5
```

Grid is packed toward the right end of the inline axis.

<a id="api-c874af544db5471d"></a>

### [`JustifyContent.SpaceAround`](#api-c874af544db5471d)


```csharp
SpaceAround = 7
```

Columns are evenly distributed with equal space around each column.

<a id="api-e0e897c00c52ecfd"></a>

### [`JustifyContent.SpaceBetween`](#api-e0e897c00c52ecfd)


```csharp
SpaceBetween = 6
```

Columns are evenly distributed; first column at start, last at end.

<a id="api-78270e1cd8548694"></a>

### [`JustifyContent.SpaceEvenly`](#api-78270e1cd8548694)


```csharp
SpaceEvenly = 8
```

Columns are evenly distributed with equal space between all columns including edges.

<a id="api-fca7320fce79fe95"></a>

### [`JustifyContent.Start`](#api-fca7320fce79fe95)


```csharp
Start = 1
```

Grid is packed toward the start of the inline axis.

<a id="api-723cd72747936fe0"></a>

### [`JustifyContent.Stretch`](#api-723cd72747936fe0)


```csharp
Stretch = 9
```

Columns are stretched to fill the container inline size.


<a id="api-33cae9fcb51d3079"></a>

## `enum Grid.JustifyItems`

Sets the default `justify-self` for all items, aligning them along the inline axis within their grid area. Corresponds to the CSS `justify-items` property.

```csharp
public enum JustifyItems : byte
{
    Normal = 0,
    Stretch = 1,
    Start = 2,
    End = 3,
    Center = 4,
    Left = 5,
    Right = 6,
    Baseline = 7,
    FirstBaseline = 8,
    LastBaseline = 9,
}
```

<a id="api-f4a1b9c04e792528"></a>

### [`JustifyItems.Baseline`](#api-f4a1b9c04e792528)


```csharp
Baseline = 7
```

Items are aligned along their first baseline.

<a id="api-6290933eb12a1e67"></a>

### [`JustifyItems.Center`](#api-6290933eb12a1e67)


```csharp
Center = 4
```

Items are centered along the inline axis.

<a id="api-803ed65aa77091a7"></a>

### [`JustifyItems.End`](#api-803ed65aa77091a7)


```csharp
End = 3
```

Items are packed toward the end of the inline axis.

<a id="api-5a53d6ff9d8b23f8"></a>

### [`JustifyItems.FirstBaseline`](#api-5a53d6ff9d8b23f8)


```csharp
FirstBaseline = 8
```

Items are aligned along their first baseline (same as [`Xui.Core.UI.Layout.Grid.JustifyItems.Baseline`](../xui-core-ui-layout/index.md#api-f4a1b9c04e792528)).

<a id="api-c8b1ece1121bc65a"></a>

### [`JustifyItems.LastBaseline`](#api-c8b1ece1121bc65a)


```csharp
LastBaseline = 9
```

Items are aligned along their last baseline.

<a id="api-3e3ec2aca92c1701"></a>

### [`JustifyItems.Left`](#api-3e3ec2aca92c1701)


```csharp
Left = 5
```

Items are packed toward the left end of the inline axis.

<a id="api-6185a8c5fb45642e"></a>

### [`JustifyItems.Normal`](#api-6185a8c5fb45642e)


```csharp
Normal = 0
```

Browser default. Acts like [`Xui.Core.UI.Layout.Grid.JustifyItems.Stretch`](../xui-core-ui-layout/index.md#api-c9b4faaf8ead5b70).

<a id="api-e7b7f4313a29e5bf"></a>

### [`JustifyItems.Right`](#api-e7b7f4313a29e5bf)


```csharp
Right = 6
```

Items are packed toward the right end of the inline axis.

<a id="api-3a397166276beb0c"></a>

### [`JustifyItems.Start`](#api-3a397166276beb0c)


```csharp
Start = 2
```

Items are packed toward the start of the inline axis.

<a id="api-c9b4faaf8ead5b70"></a>

### [`JustifyItems.Stretch`](#api-c9b4faaf8ead5b70)


```csharp
Stretch = 1
```

Items are stretched to fill the grid area inline size.


<a id="api-ddf1ae49081f845a"></a>

## `readonly struct Grid.TrackSize`

Represents a single CSS grid track sizing value such as a length, `fr` unit, `auto`, `min-content`, `max-content`, `minmax()`, or `fit-content()`.

```csharp
public readonly struct TrackSize
{
    public TrackSizeKind Kind { get; }
    public nfloat Value { get; }
    public nfloat MinValue { get; }
    public nfloat MaxValue { get; }

    public static readonly TrackSize Auto;
    public static readonly TrackSize MinContent;
    public static readonly TrackSize MaxContent;
    public static TrackSize Px(nfloat px);
    public static TrackSize Fr(nfloat fr);
    public static TrackSize MinMax(nfloat min, nfloat max);
    public static TrackSize FitContent(nfloat max);
    public static implicit operator TrackSize(nfloat px);
    public static implicit operator TrackSize(float px);
    public static implicit operator TrackSize(double px);
    public static implicit operator TrackSize(int px);
    public override string ToString();
}
```

<a id="api-c55d1e989f312d10"></a>

### [`TrackSize TrackSize.Auto`](#api-c55d1e989f312d10)


```csharp
public static readonly TrackSize Auto;
```

The track sizes to content automatically. Equivalent to CSS `auto`.

<a id="api-0870909601ebc1df"></a>

### [`TrackSize TrackSize.FitContent(NFloat max)`](#api-0870909601ebc1df)


```csharp
public static TrackSize FitContent(nfloat max);
```

Creates a `fit-content(max)` track clamped to the given pixel maximum.

<a id="api-9c5e5aa83c0f7e1a"></a>

### [`TrackSize TrackSize.Fr(NFloat fr)`](#api-9c5e5aa83c0f7e1a)


```csharp
public static TrackSize Fr(nfloat fr);
```

Creates a fractional track. `Fr(1)` = CSS `1fr`.

<a id="api-4ed9016eb8f39942"></a>

### [`TrackSizeKind TrackSize.Kind`](#api-4ed9016eb8f39942)


```csharp
public TrackSizeKind Kind { get; }
```

The kind of track sizing function.

<a id="api-1858ff2ff1b68767"></a>

### [`TrackSize TrackSize.MaxContent`](#api-1858ff2ff1b68767)


```csharp
public static readonly TrackSize MaxContent;
```

The track is sized to the largest max-content contribution of its items. Equivalent to CSS `max-content`.

<a id="api-ab28d835228248b5"></a>

### [`NFloat TrackSize.MaxValue`](#api-ab28d835228248b5)


```csharp
public nfloat MaxValue { get; }
```

Maximum value for [`Xui.Core.UI.Layout.Grid.TrackSizeKind.MinMax`](../xui-core-ui-layout/index.md#api-acc22cc50b0d1b50) and [`Xui.Core.UI.Layout.Grid.TrackSizeKind.FitContent`](../xui-core-ui-layout/index.md#api-c3ee21cce75893ff) tracks.

<a id="api-7abe017a132ee2f9"></a>

### [`TrackSize TrackSize.MinContent`](#api-7abe017a132ee2f9)


```csharp
public static readonly TrackSize MinContent;
```

The track is sized to the smallest size that fits its content without overflow. Equivalent to CSS `min-content`.

<a id="api-e5eecba2e6ed2c2d"></a>

### [`TrackSize TrackSize.MinMax(NFloat min, NFloat max)`](#api-e5eecba2e6ed2c2d)


```csharp
public static TrackSize MinMax(nfloat min, nfloat max);
```

Creates a `minmax(min, max)` track with pixel min and max values.

<a id="api-d26bc18d1ca7b5db"></a>

### [`NFloat TrackSize.MinValue`](#api-d26bc18d1ca7b5db)


```csharp
public nfloat MinValue { get; }
```

Minimum value for [`Xui.Core.UI.Layout.Grid.TrackSizeKind.MinMax`](../xui-core-ui-layout/index.md#api-acc22cc50b0d1b50) tracks.

<a id="api-7d85c72d8a69dc54"></a>

### [`TrackSize TrackSize.Px(NFloat px)`](#api-7d85c72d8a69dc54)


```csharp
public static TrackSize Px(nfloat px);
```

Creates a track of an exact pixel length.

<a id="api-cd4a4c0a7b9d66c5"></a>

### [`string TrackSize.ToString()`](#api-cd4a4c0a7b9d66c5)


```csharp
public override string ToString();
```

Returns the fully qualified type name of this instance.

**Returns:** The fully qualified type name.

<a id="api-356e80b30e67c4a1"></a>

### [`NFloat TrackSize.Value`](#api-356e80b30e67c4a1)


```csharp
public nfloat Value { get; }
```

Pixel length for the track.

<a id="api-d65dd69ebd54f286"></a>

### [`TrackSize.implicit operator TrackSize(double px)`](#api-d65dd69ebd54f286)


```csharp
public static implicit operator TrackSize(double px);
```

Implicitly converts a pixel value to a [`Xui.Core.UI.Layout.Grid.TrackSizeKind.Length`](../xui-core-ui-layout/index.md#api-89ed366b927c1074) track.

<a id="api-43f2cbba7fc70db8"></a>

### [`TrackSize.implicit operator TrackSize(int px)`](#api-43f2cbba7fc70db8)


```csharp
public static implicit operator TrackSize(int px);
```

Implicitly converts a pixel value to a [`Xui.Core.UI.Layout.Grid.TrackSizeKind.Length`](../xui-core-ui-layout/index.md#api-89ed366b927c1074) track.

<a id="api-bcb6b9b28e725af3"></a>

### [`TrackSize.implicit operator TrackSize(NFloat px)`](#api-bcb6b9b28e725af3)


```csharp
public static implicit operator TrackSize(nfloat px);
```

Implicitly converts a pixel value to a [`Xui.Core.UI.Layout.Grid.TrackSizeKind.Length`](../xui-core-ui-layout/index.md#api-89ed366b927c1074) track.

<a id="api-76c00d053c40a3d9"></a>

### [`TrackSize.implicit operator TrackSize(float px)`](#api-76c00d053c40a3d9)


```csharp
public static implicit operator TrackSize(float px);
```

Implicitly converts a pixel value to a [`Xui.Core.UI.Layout.Grid.TrackSizeKind.Length`](../xui-core-ui-layout/index.md#api-89ed366b927c1074) track.


<a id="api-44d308c10c0d9352"></a>

## `enum Grid.TrackSizeKind`

Identifies the kind of sizing function a [`Xui.Core.UI.Layout.Grid.TrackSize`](../xui-core-ui-layout/index.md#api-ddf1ae49081f845a) represents.

```csharp
public enum TrackSizeKind : byte
{
    Auto = 0,
    MinContent = 1,
    MaxContent = 2,
    Length = 3,
    Fr = 4,
    MinMax = 5,
    FitContent = 6,
}
```

<a id="api-2795c5072e938752"></a>

### [`TrackSizeKind.Auto`](#api-2795c5072e938752)


```csharp
Auto = 0
```

Sized to available space (`auto`).

<a id="api-c3ee21cce75893ff"></a>

### [`TrackSizeKind.FitContent`](#api-c3ee21cce75893ff)


```csharp
FitContent = 6
```

Like [`Xui.Core.UI.Layout.Grid.TrackSizeKind.MaxContent`](../xui-core-ui-layout/index.md#api-060df70acaf24609) but clamped to a maximum (`fit-content()`).

<a id="api-28e101f3b0d913b2"></a>

### [`TrackSizeKind.Fr`](#api-28e101f3b0d913b2)


```csharp
Fr = 4
```

Flexible fractional unit (`fr`).

<a id="api-89ed366b927c1074"></a>

### [`TrackSizeKind.Length`](#api-89ed366b927c1074)


```csharp
Length = 3
```

Fixed pixel length.

<a id="api-060df70acaf24609"></a>

### [`TrackSizeKind.MaxContent`](#api-060df70acaf24609)


```csharp
MaxContent = 2
```

Sized to largest content contribution (`max-content`).

<a id="api-d9e481753e774c06"></a>

### [`TrackSizeKind.MinContent`](#api-d9e481753e774c06)


```csharp
MinContent = 1
```

Sized to smallest content contribution (`min-content`).

<a id="api-acc22cc50b0d1b50"></a>

### [`TrackSizeKind.MinMax`](#api-acc22cc50b0d1b50)


```csharp
MinMax = 5
```

Clamped between a min and a max (`minmax()`).

