Skip to main content
.gridCellUnsizedAxes(axes: Axis): Component
axes
Axis
required
The axes along which the cell should use its ideal size instead of the grid-assigned size. See Axis.

Support

Usage

Using ideal width in a grid cell

Grid([
    GridRow([
        Text("Fixed width")
            .gridCellUnsizedAxes("horizontal"),
        Text("Flexible")
    ]),
    GridRow([
        Text("A"),
        Text("B")
    ])
])

Using ideal height in a grid cell

Grid([
    GridRow([
        Circle()
            .frame({ width: 40, height: 40 })
            .foregroundStyle(Color("blue"))
            .gridCellUnsizedAxes("vertical"),
        Text("Description")
    ])
])

Notes

  • By default, grid cells expand to fill the space allocated by the grid. This modifier lets a cell opt out of that behavior on one or both axes, using its intrinsic (ideal) size instead.

See Also