<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 16.0.0 -",
    "macOS: 13.0.0 -",
    "tvOS: 16.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 9.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/View/gridCellUnsizedAxes(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI4ViewPAAE19gridCellUnsizedAxesyQrAA4AxisO3SetVF"
  },
  "title" : "gridCellUnsizedAxes(_:)"
}
-->

# gridCellUnsizedAxes(_:)

Asks grid layouts not to offer the view extra size in the specified
axes.

```
nonisolated func gridCellUnsizedAxes(_ axes: Axis.Set) -> some View
```

## Parameters

`axes`

The dimensions in which the grid shouldn’t offer the view a
share of any available space. This prevents a flexible view like a
[`Spacer`](/documentation/SwiftUI/Spacer), [`Divider`](/documentation/SwiftUI/Divider), or [`Color`](/documentation/SwiftUI/Color) from defining the size of
a row or column.

## Return Value

A view that doesn’t ask an enclosing grid for extra size
in one or more axes.

## Discussion

Use this modifier to prevent a flexible view from taking more space
on the specified axes than the other cells in a row or column require.
For example, consider the following [`Grid`](/documentation/SwiftUI/Grid) that places a [`Divider`](/documentation/SwiftUI/Divider)
between two rows of content:

```
Grid {
    GridRow {
        Text("Hello")
        Image(systemName: "globe")
    }
    Divider()
    GridRow {
        Image(systemName: "hand.wave")
        Text("World")
    }
}
```

The text and images all have ideal widths for their content. However,
because a divider takes as much space as its parent offers, the grid
fills the width of the display, expanding all the other cells to match:

![A screenshot of items arranged in a grid. The upper-left](images/com.apple.SwiftUI/View-gridCellUnsizedAxes-1-iOS@2x.png)

You can prevent the grid from giving the divider more width than
the other cells require by adding the modifier with the
[`Axis.horizontal`](/documentation/SwiftUI/Axis/horizontal) parameter:

```
Divider()
    .gridCellUnsizedAxes(.horizontal)
```

This restores the grid to the width that it would have without the
divider:

![A screenshot of items arranged in a grid. The upper-left](images/com.apple.SwiftUI/View-gridCellUnsizedAxes-2-iOS@2x.png)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)