Interactive previews iPad

Default Collapsed Tab Section

Sets the default expansion state for the section containing this tab to collapsed when displayed in the sidebar.

Default Collapsed Tab Section - Preview Not Available

Platform Compatibility

iOS 27.0+ iPadOS 27.0+ visionOS 27.0+

Tags

SwiftUI Code

Docs
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

More TabView Components

View all
Collapse Sidebar Sections by Default - iPadOS - Landscape - Liquid Glass - Light Mode - Preview
modifier

Collapse Sidebar Sections by Default

Collapses the section in the sidebar by default.

Default Tab Bar Placement - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
modifier

Default 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.

Tab View Customization Behavior - iPadOS - Landscape - Liquid Glass - Light Mode - Preview
modifier

Tab View Customization Behavior

Configures the customization behavior of customizable tab view content.

Tab View Customization - iPadOS - Landscape - Liquid Glass - Light Mode - Preview
modifier

Tab View Customization

Specifies the customizations to apply to the sidebar representation of the tab view.

Tab View Side Bar Footer - iPadOS - Landscape - Liquid Glass - Light Mode - Preview
modifier

Tab View Side Bar Footer

Adds a custom footer to the sidebar of a tab view.

Tab View Side Bar Bottom Bar - iPadOS - Landscape - Liquid Glass - Light Mode - Preview
modifier

Tab View Side Bar Bottom Bar

Adds a custom bottom bar to the sidebar of a tab view.

Default Adaptable Tab Bar Placement - iPadOS - Landscape - Liquid Glass - Light Mode - Preview
modifier

Default Adaptable Tab Bar Placement

Specifies the default placement for the tabs in a tab view using the adaptable sidebar style.

Tab Bar Section Actions - iPadOS - Landscape - Liquid Glass - Light Mode - Preview
modifier

Tab Bar Section Actions

Adds custom actions to a tab section.

Explore Other Components

Browse all
AccessoryCircularGaugeStyle - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
style

AccessoryCircularGaugeStyle

A gauge style that displays an open ring with a marker that appears at a point along the ring to indicate the gauge’s current value

UIKit Separator Colors - iOS on iPhone - Portrait - Flat Design - Light Mode - Preview
type

UIKit Separator Colors

The UIKit separator colors that are also used in other components, such as the TextField

Label Styles - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
style

Label Styles

Sets the style for labels within this view.

CompactMenuControlGroupStyle - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
style

CompactMenuControlGroupStyle

A control group style that presents its content as a compact menu when the user presses the control, or as a submenu when nested within a larger menu

System Image Label - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
initializer

System Image Label

Creates a label with a system icon image and a title generated from a localized string.

Store Cancellation Button - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
modifier

Store Cancellation Button

A type of button that people use to dismiss the current store presentation. It is displayed by default and only works in a sheet.

Product View - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
initializer

Product View

Creates a view to load and merchandise an individual product from the App Store.

Color Gradient - iOS on iPhone - Portrait - Flat Design - Light Mode - Preview
modifier

Color Gradient

The Color gradient modifier