<!--
{
  "availability" : [
    "iOS: 26.0.0 -",
    "iPadOS: 26.0.0 -",
    "macCatalyst: 26.0.0 -",
    "macOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/SpacerSizing",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI12SpacerSizingV"
  },
  "title" : "SpacerSizing"
}
-->

# SpacerSizing

A type which defines how spacers should size themselves.

```
struct SpacerSizing
```

## Overview

Use this type in coordination with the [`ToolbarSpacer`](/documentation/SwiftUI/ToolbarSpacer) type to define
if the spacer should be a flexible size, or a fixed size using
system-defined sizing rules.

For example, the following adds a fixed-size toolbar spacer between the
share and more buttons in the toolbar:

```
ContentView()
    .toolbar(id: "main-toolbar") {
        ToolbarItem(id: "tag") {
           TagButton()
        }
        ToolbarItem(id: "share") {
           ShareButton()
        }
        ToolbarSpacer(.fixed)
        ToolbarItem(id: "more") {
           MoreButton()
        }
    }
```

## Topics

### Type Properties

[`static let fixed: SpacerSizing`](/documentation/SwiftUI/SpacerSizing/fixed)

The fixed spacer sizing behavior. The spacer will use a pre-defined
size determined by the system and the context in which the spacer is
used.

[`static let flexible: SpacerSizing`](/documentation/SwiftUI/SpacerSizing/flexible)

The flexible spacer sizing behavior. The spacer will expand to
accommodate as much space as it is given in the current context.

## Relationships

### Conforms To

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`Sendable`](/documentation/Swift/Sendable)

---

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)