Collapse Sidebar Sections by Default
Collapses the section in the sidebar by default.
Platform Compatibility
Tags
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)Found an issue or have a suggestion?
More TabView Components
View allDefault Tab Bar Placement
Specifies the preferred placement for the tabs of a TabView in the sidebarAdaptable style on platforms where the tab bar cannot adapt between different representations, and only one representation can be shown. For example, on iOS, it can enforce the sidebar on large-screen devices like the Pro Max, and iPhone Duo. This modifier has no effect on iPadOS.
Default Collapsed Tab Section
Sets the default expansion state for the section containing this tab to collapsed when displayed in the sidebar.
Tab View Customization Behavior
Configures the customization behavior of customizable tab view content.
Tab View Customization
Specifies the customizations to apply to the sidebar representation of the tab view.
Default Adaptable Tab Bar Placement
Specifies the default placement for the tabs in a tab view using the adaptable sidebar style.
Explore Other Components
Browse allDisable Sheet Dismiss Swipe
Conditionally prevents interactive dismissal of presentations like popovers, sheets, and inspectors. Dragging the sheet is still possible to a limited extent, as shown in the screenshot, but it will never be dismissed.
UIKit Content Background colors
The UIKit colors that are also used in other components like in List and GroupBox
Group Subscription Store View
Creates a view that loads all subscriptions in a subscription group from the App Store, and merchandises them with automatic marketing content.