---
title: "Default Collapsed Tab Section | Explore SwiftUI"
description: "Sets the default expansion state for the section containing this tab to collapsed when displayed in the sidebar"
canonical_url: "https://exploreswiftui.com/library/tabview/default-collapsed-tab-section"
meta:
  author: "Explore SwiftUI"
  "og:description": "Sets the default expansion state for the section containing this tab to collapsed when displayed in the sidebar"
  "og:image": "https://exploreswiftui.com/_og/d/c_Component%2Ctitle_Default%2BCollapsed%2BTab%2BSection%2Cdescription_Sets%2Bthe%2Bdefault%2Bexpansion%2Bstate%2Bfor%2Bthe%2Bsection%2Bcontaining%2Bthis%2Btab%2Bto%2Bcollapsed%2Bwhen%2Bdisplayed%2Bin%2Bthe%2Bsidebar.%2Ccategory_TabView%2Cimage_~L2FwaS9pbWFnZXMvMjM0L3ZhcmlhbnRzLzM0MT92PTE3OTAwNzM0Nzg4NDImcj0yJnc9NjQwJmg9NDgwJmY9cG5n%2CimageMode_fit%2CimagePosition_center%2CimageFrame_~Ym9yZGVyLXJhZGl1czogMTJweCAwcHggMHB4IDEycHg7IGJvcmRlcjogMXB4IHNvbGlkIHJnYmEoMCwwLDAsMC4wNik7IGJvcmRlci1yaWdodDogMDsgYm94LXNoYWRvdzogMCAtMTBweCA1MHB4IHJnYmEoMzcsOTksMjM1LDAuMTgpOw%2Cprops_eyJwbGF0Zm9ybXMiOlsiaU9TIiwiaVBhZE9TIiwidmlzaW9uT1MiXX0%2Cp_Ii9saWJyYXJ5L3RhYnZpZXcvZGVmYXVsdC1jb2xsYXBzZWQtdGFiLXNlY3Rpb24i%2Cs_gP9_J4vLk8ocv59U.png"
  "og:image:height": "630"
  "og:image:type": image/png
  "og:image:width": "1200"
  "og:title": "Default Collapsed Tab Section | Explore SwiftUI"
  "twitter:description": "Sets the default expansion state for the section containing this tab to collapsed when displayed in the sidebar"
  "twitter:image": "https://exploreswiftui.com/_og/d/c_Component%2Ctitle_Default%2BCollapsed%2BTab%2BSection%2Cdescription_Sets%2Bthe%2Bdefault%2Bexpansion%2Bstate%2Bfor%2Bthe%2Bsection%2Bcontaining%2Bthis%2Btab%2Bto%2Bcollapsed%2Bwhen%2Bdisplayed%2Bin%2Bthe%2Bsidebar.%2Ccategory_TabView%2Cimage_~L2FwaS9pbWFnZXMvMjM0L3ZhcmlhbnRzLzM0MT92PTE3OTAwNzM0Nzg4NDImcj0yJnc9NjQwJmg9NDgwJmY9cG5n%2CimageMode_fit%2CimagePosition_center%2CimageFrame_~Ym9yZGVyLXJhZGl1czogMTJweCAwcHggMHB4IDEycHg7IGJvcmRlcjogMXB4IHNvbGlkIHJnYmEoMCwwLDAsMC4wNik7IGJvcmRlci1yaWdodDogMDsgYm94LXNoYWRvdzogMCAtMTBweCA1MHB4IHJnYmEoMzcsOTksMjM1LDAuMTgpOw%2Cprops_eyJwbGF0Zm9ybXMiOlsiaU9TIiwiaVBhZE9TIiwidmlzaW9uT1MiXX0%2Cp_Ii9saWJyYXJ5L3RhYnZpZXcvZGVmYXVsdC1jb2xsYXBzZWQtdGFiLXNlY3Rpb24i%2Cs_gP9_J4vLk8ocv59U.png"
  "twitter:title": "Default Collapsed Tab Section | Explore SwiftUI"
---

> Index of every page on this site: [llms.txt](https://exploreswiftui.com/llms.txt)

**Interactive previews**[ iPad](https://exploreswiftui.com/ipad?element=234)

# **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](https://exploreswiftui.com/api/images/234/variants/341?v=1790073478842&r=2&w=800&q=80&f=webp)

### **Platform Compatibility**

iOS 27.0+ iPadOS 27.0+ visionOS 27.0+

### **Tags**

### **SwiftUI Code**

[ Docs](https://developer.apple.com/documentation/swiftui/tabsectionexpansion/collapsed)

```
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 **](https://exploreswiftui.com/library/tabview)

![Collapse Sidebar Sections by Default - iPadOS - Landscape - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/259/variants/2039?v=1792566366133&r=2&w=412&q=75&f=webp)

### **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](https://exploreswiftui.com/api/images/239/variants/2069?v=1792681374978&r=2&w=412&q=75&f=webp)

### **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](https://exploreswiftui.com/api/images/166/variants/669?v=1790073478842&r=2&w=412&q=75&f=webp)

### **Tab View Customization Behavior**

Configures the customization behavior of customizable tab view content.

![Tab View Customization - iPadOS - Landscape - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/164/variants/671?v=1790073478842&r=2&w=412&q=75&f=webp)

### **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](https://exploreswiftui.com/api/images/168/variants/735?v=1790073478842&r=2&w=412&q=75&f=webp)

### **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](https://exploreswiftui.com/api/images/169/variants/707?v=1790073478842&r=2&w=412&q=75&f=webp)

### **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](https://exploreswiftui.com/api/images/170/variants/673?v=1790073478842&r=2&w=412&q=75&f=webp)

### **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](https://exploreswiftui.com/api/images/171/variants/631?v=1790073478842&r=2&w=412&q=75&f=webp)

### **Tab Bar Section Actions**

Adds custom actions to a tab section.

### **Explore Other Components **

[**Browse all **](https://exploreswiftui.com/)

![Label Icon To Title Spacing - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/274/variants/2467?v=1795268393880&r=2&w=412&q=75&f=webp)

### **Label Icon To Title Spacing**

Set the spacing between the icon and title in labels.

![Toolbar Title Alignment - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/258/variants/2111?v=1793542963212&r=2&w=412&q=75&f=webp)

### **Toolbar Title Alignment**

Sets the preferred alignment of the navigation bar’s title. The navigation bar resolves the alignment of its title automatically based on context, and toolbar roles. Use this modifier to override that resolution.

![Materials - iOS on iPhone - Portrait - Flat Design - Light Mode - Preview](https://exploreswiftui.com/api/images/26/variants/169?v=1790073478842&r=2&w=412&q=75&f=webp)

### **Materials**

All materials

![Semantic Colors - iOS on iPhone - Portrait - Flat Design - Light Mode - Preview](https://exploreswiftui.com/api/images/8/variants/51?v=1790073478842&r=2&w=412&q=75&f=webp)

### **Semantic Colors**

![GroupBox With Label - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/28/variants/195?v=1790073478842&r=2&w=412&q=75&f=webp)

### **GroupBox With Label**

A GroupBox with Label

![Disabled Toolbar Vertical Behavior - iOS on iPhone Duo - Landscape - Fully Open - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/246/variants/1636?v=1790277107518&r=2&w=412&q=75&f=webp)

### **Disabled Toolbar Vertical Behavior**

Disables the vertical bar.

![UIKit Text Colors - iOS on iPhone - Portrait - Flat Design - Light Mode - Preview](https://exploreswiftui.com/api/images/12/variants/55?v=1790073478842&r=2&w=412&q=75&f=webp)

### **UIKit Text Colors**

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

![Music Picker - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/232/variants/727?v=1790073478842&r=2&w=412&q=75&f=webp)

### **Music Picker**

Presents a music picker to select items from the Apple Music catalog and the user’s music library.

```json
{"@context":"https://schema.org","@graph":[{"@id":"https://exploreswiftui.com/#website","@type":"WebSite","description":"A visual library for SwiftUI APIs, components, and modifiers","inLanguage":"en-US","name":"Explore SwiftUI","url":"https://exploreswiftui.com/","publisher":{"@id":"https://exploreswiftui.com/#identity"}},{"@id":"https://exploreswiftui.com/library/tabview/default-collapsed-tab-section#webpage","@type":"WebPage","dateModified":"2026-08-23T14:49:48.643Z","datePublished":"2026-08-23T14:49:48.643Z","description":"Sets the default expansion state for the section containing this tab to collapsed when displayed in the sidebar","name":"Default Collapsed Tab Section","url":"https://exploreswiftui.com/library/tabview/default-collapsed-tab-section","breadcrumb":{"@id":"https://exploreswiftui.com/library/tabview/default-collapsed-tab-section#breadcrumb"},"isPartOf":{"@id":"https://exploreswiftui.com/#website"},"mainEntity":{"@id":"https://exploreswiftui.com/library/tabview/default-collapsed-tab-section#article"},"potentialAction":[{"@type":"ReadAction","target":["https://exploreswiftui.com/library/tabview/default-collapsed-tab-section"]}],"primaryImageOfPage":{"@id":"https://exploreswiftui.com/#logo"}},{"@id":"https://exploreswiftui.com/#identity","@type":"Organization","description":"A visual library for SwiftUI APIs, components, and modifiers","name":"Explore SwiftUI","url":"https://exploreswiftui.com","logo":{"@id":"https://exploreswiftui.com/#logo"},"sameAs":["https://x.com/Typ0genius","https://mastodon.social/@Typ0genius"]},{"@id":"https://exploreswiftui.com/library/tabview/default-collapsed-tab-section#article","citation":"https://developer.apple.com/documentation/swiftui/tabsectionexpansion/collapsed","dateModified":"2026-08-23T14:49:48.643Z","datePublished":"2026-08-23T14:49:48.643Z","description":"Sets the default expansion state for the section containing this tab to collapsed when displayed in the sidebar","headline":"Default Collapsed Tab Section","inLanguage":"en-US","name":"Default Collapsed Tab Section","thumbnailUrl":"https://exploreswiftui.com/api/images/234/variants/341?v=1790073478842&r=2","url":"https://exploreswiftui.com/library/tabview/default-collapsed-tab-section","@type":["Article","TechArticle"],"about":{"@type":"Thing","name":"SwiftUI"},"author":{"@id":"https://exploreswiftui.com/#identity"},"hasPart":{"@id":"https://exploreswiftui.com/library/tabview/default-collapsed-tab-section#source-code"},"image":{"@id":"https://exploreswiftui.com/#/schema/image/1"},"isPartOf":{"@id":"https://exploreswiftui.com/library/tabview/default-collapsed-tab-section#webpage"},"mainEntityOfPage":{"@id":"https://exploreswiftui.com/library/tabview/default-collapsed-tab-section#webpage"},"publisher":{"@id":"https://exploreswiftui.com/#identity"}},{"@id":"https://exploreswiftui.com/library/tabview/default-collapsed-tab-section#source-code","@type":"SoftwareSourceCode","codeSampleType":"full example","description":"Sets the default expansion state for the section containing this tab to collapsed when displayed in the sidebar","name":"Default Collapsed Tab Section SwiftUI Example","programmingLanguage":"Swift","runtimePlatform":"SwiftUI","text":"TabView {\n    TabSection(\"Foo\") {\n        Tab {\n            Text(\"0\")\n        } label: {\n            Text(\"1\")\n        }\n    }\n\n    TabSection(\"Bar\") {\n        Tab {\n            Text(\"2\")\n        } label: {\n            Text(\"3\")\n        }\n    }\n    .defaultSectionExpansion(.collapsed)\n\n    TabSection(\"FooBar\") {\n        Tab {\n            Text(\"4\")\n        } label: {\n            Text(\"5\")\n        }\n    }\n}\n.tabViewStyle(.sidebarAdaptable)","about":[{"@type":"Thing","name":"SwiftUI"},{"@type":"Thing","name":"TabView"},{"@type":"Thing","name":"Default Collapsed Tab Section"}]},{"@id":"https://exploreswiftui.com/library/tabview/default-collapsed-tab-section#breadcrumb","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","name":"Home","item":"https://exploreswiftui.com","position":1},{"@type":"ListItem","name":"TabView","item":"https://exploreswiftui.com/library/tabview","position":2},{"@type":"ListItem","name":"Default Collapsed Tab Section","item":"https://exploreswiftui.com/library/tabview/default-collapsed-tab-section","position":3}]},{"@id":"https://exploreswiftui.com/#logo","@type":"ImageObject","caption":"Explore SwiftUI","contentUrl":"https://exploreswiftui.com/apple-touch-icon.png","inLanguage":"en","url":"https://exploreswiftui.com/apple-touch-icon.png"},{"@id":"https://exploreswiftui.com/#/schema/image/1","@type":"ImageObject","contentUrl":"https://exploreswiftui.com/api/images/234/variants/341?v=1790073478842&r=2","inLanguage":"en","url":"https://exploreswiftui.com/api/images/234/variants/341?v=1790073478842&r=2"}]}
```