Default Collapsed Tab Section
Sets the default expansion state for the section containing this tab to collapsed when displayed in the sidebar.
Platform Compatibility
iOS 27.0+ iPadOS 27.0+ visionOS 27.0+
Tags
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)Found an issue or have a suggestion?
Created: August 23, 2026Updated: August 23, 2026