iPad SwiftUI layouts
Explore SwiftUI APIs, components, and modifiers with interactive iPad previews, Swift code, and Apple documentation.
24elements
TabView
Collapse Sidebar Sections by Default
Collapses the section in the sidebar by default.
Explore Collapse Sidebar Sections by Default on iPad in landscape, with SwiftUI code and Apple API documentation.
SwiftUI code
TabView {
TabSection("Foo") {
Tab("1", systemImage: "1.circle") {
Text("0")
}
}
.defaultSectionExpansion(.collapsed)
TabSection("Bar") {
Tab("3", systemImage: "3.circle") {
Text("2")
}
}
TabSection("FooBar") {
Tab("5", systemImage: "5.circle") {
Text("4")
}
}
}
.tabViewStyle(.sidebarAdaptable)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 iPad screenshot for Collapse Sidebar Sections by Default.