iPhone SwiftUI layouts
Explore SwiftUI APIs, components, and modifiers with interactive iPhone previews, Swift code, and Apple documentation. Compare every available orientation, appearance, and design.
201elements
Toolbars
Remove Toolbar Item Margin
Configures whether the content margins are removed.
Explore Remove Toolbar Item Margin on iPhone in portrait, with SwiftUI code and Apple API documentation.
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)
}
}Compatibility
iOS 27.0+ iPadOS 27.0+ macOS 27.0+ watchOS 27.0+ tvOS 27.0+ visionOS 27.0+
Tags
Found an issue or have a suggestion?
All variants
Every available iPhone screenshot for Remove Toolbar Item Margin.