Remove Toolbar Item Margin
Configures whether the content margins are removed.
Platform Compatibility
iOS 27.0+ iPadOS 27.0+ macOS 27.0+ watchOS 27.0+ tvOS 27.0+ visionOS 27.0+
Tags
SwiftUI Code
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