---
title: "Remove Toolbar Item Margin | Explore SwiftUI"
description: "Configures whether the content margins are removed. Learn how to use Remove Toolbar Item Margin in SwiftUI with visual code examples."
canonical_url: "https://exploreswiftui.com/library/toolbars/remove-toolbar-item-margin"
meta:
  author: "Explore SwiftUI"
  "og:description": "Configures whether the content margins are removed. Learn how to use Remove Toolbar Item Margin in SwiftUI with visual code examples."
  "og:image": "https://exploreswiftui.com/_og/d/c_Component%2Ctitle_Remove%2BToolbar%2BItem%2BMargin%2Cdescription_Explore%2Bvisually%2Bwith%2Bcode%2Bexamples%2Ccategory_Toolbars%2Cprops_eyJwbGF0Zm9ybXMiOlsiaU9TIiwiaVBhZE9TIiwibWFjT1MiLCJ3YXRjaE9TIiwidHZPUyIsInZpc2lvbk9TIl19%2Cp_Ii9saWJyYXJ5L3Rvb2xiYXJzL3JlbW92ZS10b29sYmFyLWl0ZW0tbWFyZ2luIg%2Cs_BQqPx8xZBc9QMZEk.png"
  "og:image:height": "630"
  "og:image:type": image/png
  "og:image:width": "1200"
  "og:title": "Remove Toolbar Item Margin | Explore SwiftUI"
  "twitter:description": "Configures whether the content margins are removed. Learn how to use Remove Toolbar Item Margin in SwiftUI with visual code examples."
  "twitter:image": "https://exploreswiftui.com/_og/d/c_Component%2Ctitle_Remove%2BToolbar%2BItem%2BMargin%2Cdescription_Explore%2Bvisually%2Bwith%2Bcode%2Bexamples%2Ccategory_Toolbars%2Cprops_eyJwbGF0Zm9ybXMiOlsiaU9TIiwiaVBhZE9TIiwibWFjT1MiLCJ3YXRjaE9TIiwidHZPUyIsInZpc2lvbk9TIl19%2Cp_Ii9saWJyYXJ5L3Rvb2xiYXJzL3JlbW92ZS10b29sYmFyLWl0ZW0tbWFyZ2luIg%2Cs_BQqPx8xZBc9QMZEk.png"
  "twitter:title": "Remove Toolbar Item Margin | Explore SwiftUI"
---

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

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

# **Remove Toolbar Item Margin**

Configures whether the content margins are removed.

![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=800&q=80&f=webp)

### **Platform Compatibility**

iOS 27.0+ iPadOS 27.0+ macOS 27.0+ watchOS 27.0+ tvOS 27.0+ visionOS 27.0+

### **Tags**

### **SwiftUI Code**

[ Docs](<https://developer.apple.com/documentation/SwiftUI/ToolbarContent/contentMarginsRemoved(_:)>)

```
NavigationStack {
    Text("FooBar")
        .toolbar {
            ToolbarItem {
                Text("Foo")
                    .frame(maxWidth: .infinity, maxHeight: .infinity)
                    .background(.blue.tertiary)
            }
            ToolbarSpacer()
            ToolbarItem {
                Text("Bar")
                    .frame(maxWidth: .infinity, maxHeight: .infinity)
                    .background(.blue.tertiary)
            }
            .contentMarginsRemoved(true)
        }
    }
```

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

Created: August 30, 2026Updated: August 30, 2026

![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)

```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/remove-toolbar-item-margin#webpage","@type":"WebPage","dateModified":"2026-08-30T11:27:37.831Z","datePublished":"2026-08-30T11:23:11.160Z","description":"Configures whether the content margins are removed. Learn how to use Remove Toolbar Item Margin in SwiftUI with visual code examples.","name":"Remove Toolbar Item Margin","url":"https://exploreswiftui.com/library/toolbars/remove-toolbar-item-margin","breadcrumb":{"@id":"https://exploreswiftui.com/library/toolbars/remove-toolbar-item-margin#breadcrumb"},"isPartOf":{"@id":"https://exploreswiftui.com/#website"},"potentialAction":[{"@type":"ReadAction","target":["https://exploreswiftui.com/library/toolbars/remove-toolbar-item-margin"]}],"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/remove-toolbar-item-margin#article","dateModified":"2026-08-30T11:27:37.831Z","datePublished":"2026-08-30T11:23:11.160Z","description":"Configures whether the content margins are removed. Learn how to use Remove Toolbar Item Margin in SwiftUI with visual code examples.","headline":"Remove Toolbar Item Margin","inLanguage":"en-US","name":"Remove Toolbar Item Margin","thumbnailUrl":"https://exploreswiftui.com/api/images/235/variants/665?v=1790073478842&r=2","url":"https://exploreswiftui.com/library/toolbars/remove-toolbar-item-margin","@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/remove-toolbar-item-margin#webpage"},"publisher":{"@id":"https://exploreswiftui.com/#identity"}},{"@id":"https://exploreswiftui.com/library/toolbars/remove-toolbar-item-margin#/schema/software-source-code/1","@type":"SoftwareSourceCode","codeRepository":"https://developer.apple.com/documentation/SwiftUI/ToolbarContent/contentMarginsRemoved(_:)","codeSampleType":"full example","description":"Configures whether the content margins are removed. Learn how to use Remove Toolbar Item Margin in SwiftUI with visual code examples.","name":"Remove Toolbar Item Margin SwiftUI Example","programmingLanguage":"Swift","runtimePlatform":"SwiftUI","text":"NavigationStack {\n    Text(\"FooBar\")\n        .toolbar {\n            ToolbarItem {\n                Text(\"Foo\")\n                    .frame(maxWidth: .infinity, maxHeight: .infinity)\n                    .background(.blue.tertiary)\n            }\n            ToolbarSpacer()\n            ToolbarItem {\n                Text(\"Bar\")\n                    .frame(maxWidth: .infinity, maxHeight: .infinity)\n                    .background(.blue.tertiary)\n            }\n            .contentMarginsRemoved(true)\n        }\n    }","about":[{"@type":"Thing","name":"SwiftUI"},{"@type":"Thing","name":"Toolbars"},{"@type":"Thing","name":"Remove Toolbar Item Margin"}]},{"@id":"https://exploreswiftui.com/library/toolbars/remove-toolbar-item-margin#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":"Remove Toolbar Item Margin","item":"https://exploreswiftui.com/library/toolbars/remove-toolbar-item-margin","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/235/variants/665?v=1790073478842&r=2","inLanguage":"en","url":"https://exploreswiftui.com/api/images/235/variants/665?v=1790073478842&r=2"}]}
```