iPad SwiftUI layouts
Explore SwiftUI APIs, components, and modifiers with interactive iPad previews, Swift code, and Apple documentation.
24elements
TabView
Default Collapsed Tab Section
Sets the default expansion state for the section containing this tab to collapsed when displayed in the sidebar.
Explore Default Collapsed Tab Section on iPad in landscape, with SwiftUI code and Apple API documentation.
SwiftUI code
TabView {
TabSection("Foo") {
Tab {
Text("0")
} label: {
Text("1")
}
}
TabSection("Bar") {
Tab {
Text("2")
} label: {
Text("3")
}
}
.defaultSectionExpansion(.collapsed)
TabSection("FooBar") {
Tab {
Text("4")
} label: {
Text("5")
}
}
}
.tabViewStyle(.sidebarAdaptable)Compatibility
iOS 27.0+ iPadOS 27.0+ visionOS 27.0+
Tags
Found an issue or have a suggestion?
All variants
Every available iPad screenshot for Default Collapsed Tab Section.