---
title: "ToolbarSpacer | Explore SwiftUI"
description: "A standard space item in toolbars. Learn how to use ToolbarSpacer in SwiftUI with visual code examples for iOS, macOS, watchOS, tvOS, and visionOS."
canonical_url: "https://exploreswiftui.com/library/toolbars/toolbarspacer"
meta:
  author: "Explore SwiftUI"
  "og:description": "A standard space item in toolbars. Learn how to use ToolbarSpacer in SwiftUI with visual code examples for iOS, macOS, watchOS, tvOS, and visionOS."
  "og:image": "https://exploreswiftui.com/_og/d/c_Component%2Ctitle_ToolbarSpacer%2Cdescription_A%2Bstandard%2Bspace%2Bitem%2Bin%2Btoolbars%2Ccategory_Toolbars%2Cimage_~L2FwaS9pbWFnZXMvODIvdmFyaWFudHMvMTA2P3Y9MTc5MDA3MzQ3ODg0MiZyPTImdz0xMjgwJnE9ODUmZj1qcGVn%2CimageMode_crop%2CimagePosition_top%2CimageFrame_~cG9zaXRpb246IGFic29sdXRlOyByaWdodDogMDsgd2lkdGg6IDY0MHB4OyBoZWlnaHQ6IDQ4MHB4OyBkaXNwbGF5OiBmbGV4OyBvdmVyZmxvdzogaGlkZGVuOyBiYWNrZ3JvdW5kOiAjRkZGRkZGOyBib3gtc2hhZG93OiAwIC0xMHB4IDUwcHggcmdiYSgzNyw5OSwyMzUsMC4xOCk7IGJvcmRlci1sZWZ0OiAxcHggc29saWQgcmdiYSgwLDAsMCwwLjA2KTsgYm90dG9tOiAwOyBib3JkZXItdG9wOiAxcHggc29saWQgcmdiYSgwLDAsMCwwLjA2KTsgYm9yZGVyLXRvcC1sZWZ0LXJhZGl1czogNzRweDs%2Cprops_eyJwbGF0Zm9ybXMiOlsiaU9TIiwiaVBhZE9TIiwibWFjT1MiXX0%2Cp_Ii9saWJyYXJ5L3Rvb2xiYXJzL3Rvb2xiYXJzcGFjZXIi%2Cs_-4x638ITcwzre90V.png"
  "og:image:height": "630"
  "og:image:type": image/png
  "og:image:width": "1200"
  "og:title": "ToolbarSpacer | Explore SwiftUI"
  "twitter:description": "A standard space item in toolbars. Learn how to use ToolbarSpacer in SwiftUI with visual code examples for iOS, macOS, watchOS, tvOS, and visionOS."
  "twitter:image": "https://exploreswiftui.com/_og/d/c_Component%2Ctitle_ToolbarSpacer%2Cdescription_A%2Bstandard%2Bspace%2Bitem%2Bin%2Btoolbars%2Ccategory_Toolbars%2Cimage_~L2FwaS9pbWFnZXMvODIvdmFyaWFudHMvMTA2P3Y9MTc5MDA3MzQ3ODg0MiZyPTImdz0xMjgwJnE9ODUmZj1qcGVn%2CimageMode_crop%2CimagePosition_top%2CimageFrame_~cG9zaXRpb246IGFic29sdXRlOyByaWdodDogMDsgd2lkdGg6IDY0MHB4OyBoZWlnaHQ6IDQ4MHB4OyBkaXNwbGF5OiBmbGV4OyBvdmVyZmxvdzogaGlkZGVuOyBiYWNrZ3JvdW5kOiAjRkZGRkZGOyBib3gtc2hhZG93OiAwIC0xMHB4IDUwcHggcmdiYSgzNyw5OSwyMzUsMC4xOCk7IGJvcmRlci1sZWZ0OiAxcHggc29saWQgcmdiYSgwLDAsMCwwLjA2KTsgYm90dG9tOiAwOyBib3JkZXItdG9wOiAxcHggc29saWQgcmdiYSgwLDAsMCwwLjA2KTsgYm9yZGVyLXRvcC1sZWZ0LXJhZGl1czogNzRweDs%2Cprops_eyJwbGF0Zm9ybXMiOlsiaU9TIiwiaVBhZE9TIiwibWFjT1MiXX0%2Cp_Ii9saWJyYXJ5L3Rvb2xiYXJzL3Rvb2xiYXJzcGFjZXIi%2Cs_-4x638ITcwzre90V.png"
  "twitter:title": "ToolbarSpacer | Explore SwiftUI"
---

> Index of every page on this site: [llms.txt](https://exploreswiftui.com/llms.txt)

**Interactive previews**[ iPhone](https://exploreswiftui.com/iphone?element=82)

# **ToolbarSpacer**

A standard space item in toolbars

![ToolbarSpacer - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/82/variants/106?v=1790073478842&r=2&w=800&q=80&f=webp)

### **Platform Compatibility**

iOS 26.0+ iPadOS 26.0+ macOS 26.0+

### **Tags**

### **SwiftUI Code**

[ Docs](https://developer.apple.com/documentation/swiftui/toolbarspacer)

```
content
  .toolbar {
  ToolbarItemGroup(placement: .primaryAction) {
    Button("Up", systemImage: "chevron.up", action: action)
    Button("Down", systemImage: "chevron.down", action: action)
  }
  ToolbarSpacer(.fixed, placement: .primaryAction)
  ToolbarItem(placement: .primaryAction) {
    Button("Settings", systemImage: "ellipsis", action: action)
  }
}
```

### **Found an issue or have a suggestion?**

Created: June 10, 2025Updated: December 27, 2025

![Connect Wizard](https://exploreswiftui.com/_ipx/f_webp&q_80&s_48x48/images/connect-wizard-icon.png)

**Connect Wizard**

**Unlock insights App Store Connect doesn’t show you.**

[** Get Started **](https://apps.apple.com/app/apple-store/id6747314580?pt=121213751&ct=Explore%20SwiftUI%20Banner&mt=8)

### **More Toolbars Components **

[**View all **](https://exploreswiftui.com/library/toolbars)

![Prefer Vertical Toolbar Items - iOS on iPhone Duo - Landscape - Closed - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/248/variants/1749?v=1790419867105&r=2&w=412&q=75&f=webp)

### **Prefer Vertical Toolbar Items**

A compression behavior that prioritizes keeping toolbar items visible over other elements, such as tabs. By default, tabs are prioritized.

![Axis Behavior - iOS on iPhone Duo - Landscape - Closed - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/247/variants/1692?v=1790586402346&r=2&w=412&q=75&f=webp)

### **Axis Behavior**

The bar axis behavior of the toolbar item.

![Toolbar Item Visibility Priority - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/238/variants/733?v=1792389091475&r=2&w=412&q=75&f=webp)

### **Toolbar Item Visibility Priority**

Defines the visibility priority for a toolbar item.

![Toolbar Overflow Menu - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/237/variants/731?v=1790073478842&r=2&w=412&q=75&f=webp)

### **Toolbar Overflow Menu**

The overflow menu of a toolbar. An overflow menu represents actions that are always placed in the toolbar’s overflow menu, regardless of the toolbar mode, platform, or customizability.

![Pinned Toolbar Item Placement - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/236/variants/527?v=1790073478842&r=2&w=412&q=75&f=webp)

### **Pinned Toolbar Item Placement**

A placement that pins the item to the trailing edge of the toolbar.

![Remove Toolbar Item Margin - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/235/variants/665?v=1790073478842&r=2&w=412&q=75&f=webp)

### **Remove Toolbar Item Margin**

Configures whether the content margins are removed.

![Title Toolbar Item Placement - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/95/variants/279?v=1790073478842&r=2&w=412&q=75&f=webp)

### **Title Toolbar Item Placement**

Places content in the title area

![ToolbarItem Shared Background Visibility - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/92/variants/295?v=1790073478842&r=2&w=412&q=75&f=webp)

### **ToolbarItem Shared Background Visibility**

Controls the visibility of the glass background effect on items in the toolbar. In certain contexts, such as the navigation bar on iOS and the window toolbar on macOS, toolbar items will be given a glass background effect that is shared with other items in the same logical grouping

### **Explore Other Components **

[**Browse all **](https://exploreswiftui.com/)

![Hinge State - iOS on iPhone Duo - Landscape - Fully Open - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/249/variants/1765?v=1793099575627&r=2&w=412&q=75&f=webp)

### **Hinge State**

A type encapsulating the state of a single hinge.

![ControlSize - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/97/variants/303?v=1790073478842&r=2&w=412&q=75&f=webp)

### **ControlSize**

A control version that is the default size

![NavigationSplitView - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/241/variants/1983?v=1791379705544&r=2&w=412&q=75&f=webp)

### **NavigationSplitView**

Creates a two-column navigation split view.

![Content Unavailable Search Text - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/3/variants/10?v=1790073478842&r=2&w=412&q=75&f=webp)

### **Content Unavailable Search Text**

A pre-built placeholder for empty search results with search text

![TabView - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/155/variants/690?v=1790418883969&r=2&w=412&q=75&f=webp)

### **TabView**

Creates Tabs with title, image, systemImage and custom Label.

![Link - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/73/variants/207?v=1790073478842&r=2&w=412&q=75&f=webp)

### **Link**

A control for navigating to a URL

![BorderedListStyle - macOS - Flat Design - Light Mode - Preview](https://exploreswiftui.com/api/images/101/variants/308?v=1790073478842&r=2&w=412&q=75&f=webp)

### **BorderedListStyle**

The list style that describes the behavior and appearance of a list with standard border.

![UIKit Text Colors - iOS on iPhone - Portrait - Flat Design - Light Mode - Preview](https://exploreswiftui.com/api/images/12/variants/55?v=1790073478842&r=2&w=412&q=75&f=webp)

### **UIKit Text Colors**

The UIKit text colors that are also used in other components, such as the TextField

```json
{"@context":"https://schema.org","@graph":[{"@id":"https://exploreswiftui.com/#website","@type":"WebSite","description":"A visual library for SwiftUI APIs, components, and modifiers","inLanguage":"en-US","name":"Explore SwiftUI","url":"https://exploreswiftui.com/","publisher":{"@id":"https://exploreswiftui.com/#identity"}},{"@id":"https://exploreswiftui.com/library/toolbars/toolbarspacer#webpage","@type":"WebPage","dateModified":"2025-12-27T10:03:48.173Z","datePublished":"2025-06-10T05:25:26.855Z","description":"A standard space item in toolbars. Learn how to use ToolbarSpacer in SwiftUI with visual code examples for iOS, macOS, watchOS, tvOS, and visionOS.","name":"ToolbarSpacer","url":"https://exploreswiftui.com/library/toolbars/toolbarspacer","breadcrumb":{"@id":"https://exploreswiftui.com/library/toolbars/toolbarspacer#breadcrumb"},"isPartOf":{"@id":"https://exploreswiftui.com/#website"},"potentialAction":[{"@type":"ReadAction","target":["https://exploreswiftui.com/library/toolbars/toolbarspacer"]}],"primaryImageOfPage":{"@id":"https://exploreswiftui.com/#logo"}},{"@id":"https://exploreswiftui.com/#identity","@type":"Organization","description":"A visual library for SwiftUI APIs, components, and modifiers","name":"Explore SwiftUI","url":"https://exploreswiftui.com","logo":{"@id":"https://exploreswiftui.com/#logo"},"sameAs":["https://x.com/Typ0genius","https://mastodon.social/@Typ0genius"]},{"@id":"https://exploreswiftui.com/library/toolbars/toolbarspacer#article","dateModified":"2025-12-27T10:03:48.173Z","datePublished":"2025-06-10T05:25:26.855Z","description":"A standard space item in toolbars. Learn how to use ToolbarSpacer in SwiftUI with visual code examples for iOS, macOS, watchOS, tvOS, and visionOS.","headline":"ToolbarSpacer","inLanguage":"en-US","name":"ToolbarSpacer","thumbnailUrl":"https://exploreswiftui.com/api/images/82/variants/106?v=1790073478842&r=2","url":"https://exploreswiftui.com/library/toolbars/toolbarspacer","@type":["Article","TechArticle"],"about":{"@type":"Thing","name":"SwiftUI"},"author":{"@id":"https://exploreswiftui.com/#identity"},"image":{"@id":"https://exploreswiftui.com/#/schema/image/1"},"isPartOf":{"@type":"WebSite","name":"Explore SwiftUI","url":"https://exploreswiftui.com"},"mainEntityOfPage":{"@id":"https://exploreswiftui.com/library/toolbars/toolbarspacer#webpage"},"publisher":{"@id":"https://exploreswiftui.com/#identity"}},{"@id":"https://exploreswiftui.com/library/toolbars/toolbarspacer#/schema/software-source-code/1","@type":"SoftwareSourceCode","codeRepository":"https://developer.apple.com/documentation/swiftui/toolbarspacer","codeSampleType":"full example","description":"A standard space item in toolbars. Learn how to use ToolbarSpacer in SwiftUI with visual code examples for iOS, macOS, watchOS, tvOS, and visionOS.","name":"ToolbarSpacer SwiftUI Example","programmingLanguage":"Swift","runtimePlatform":"SwiftUI","text":"content\n  .toolbar {\n  ToolbarItemGroup(placement: .primaryAction) {\n    Button(\"Up\", systemImage: \"chevron.up\", action: action)\n    Button(\"Down\", systemImage: \"chevron.down\", action: action)\n  }\n  ToolbarSpacer(.fixed, placement: .primaryAction)\n  ToolbarItem(placement: .primaryAction) {\n    Button(\"Settings\", systemImage: \"ellipsis\", action: action)\n  }\n}","about":[{"@type":"Thing","name":"SwiftUI"},{"@type":"Thing","name":"Toolbars"},{"@type":"Thing","name":"ToolbarSpacer"}]},{"@id":"https://exploreswiftui.com/library/toolbars/toolbarspacer#breadcrumb","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","name":"Home","item":"https://exploreswiftui.com","position":1},{"@type":"ListItem","name":"Toolbars","item":"https://exploreswiftui.com/library/toolbars","position":2},{"@type":"ListItem","name":"ToolbarSpacer","item":"https://exploreswiftui.com/library/toolbars/toolbarspacer","position":3}]},{"@id":"https://exploreswiftui.com/#logo","@type":"ImageObject","caption":"Explore SwiftUI","contentUrl":"https://exploreswiftui.com/apple-touch-icon.png","inLanguage":"en","url":"https://exploreswiftui.com/apple-touch-icon.png"},{"@id":"https://exploreswiftui.com/#/schema/image/1","@type":"ImageObject","contentUrl":"https://exploreswiftui.com/api/images/82/variants/106?v=1790073478842&r=2","inLanguage":"en","url":"https://exploreswiftui.com/api/images/82/variants/106?v=1790073478842&r=2"}]}
```