<!--
{
  "availability" : [
    "iOS: 14.0.0 -",
    "iPadOS: 14.0.0 -",
    "macCatalyst: 14.0.0 -",
    "macOS: 11.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/DisclosureGroup",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI15DisclosureGroupV"
  },
  "title" : "DisclosureGroup"
}
-->

# DisclosureGroup

A view that shows or hides another content view, based on the state of a
disclosure control.

```
nonisolated struct DisclosureGroup<Label, Content> where Label : View, Content : View
```

## Overview

A disclosure group view consists of a label to identify the contents, and a
control to show and hide the contents. Showing the contents puts the
disclosure group into the “expanded” state, and hiding them makes the
disclosure group “collapsed”.

In the following example, a disclosure group contains two toggles and
an embedded disclosure group. The top level disclosure group exposes its
expanded state with the bound property, `topLevelExpanded`. By expanding
the disclosure group, the user can use the toggles to update the state of
the `toggleStates` structure.

```
struct ToggleStates {
    var oneIsOn: Bool = false
    var twoIsOn: Bool = true
}
@State private var toggleStates = ToggleStates()
@State private var topExpanded: Bool = true

var body: some View {
    DisclosureGroup("Items", isExpanded: $topExpanded) {
        Toggle("Toggle 1", isOn: $toggleStates.oneIsOn)
        Toggle("Toggle 2", isOn: $toggleStates.twoIsOn)
        DisclosureGroup("Sub-items") {
            Text("Sub-item 1")
        }
    }
}
```

## Topics

### Creating a disclosure group

[`init(_:content:)`](/documentation/SwiftUI/DisclosureGroup/init(_:content:))

Creates a disclosure group, using a provided localized string resource
to create a text view for the label.

[`init(content:label:)`](/documentation/SwiftUI/DisclosureGroup/init(content:label:))

Creates a disclosure group with the given label and content views.

[`init(_:isExpanded:content:)`](/documentation/SwiftUI/DisclosureGroup/init(_:isExpanded:content:))

Creates a disclosure group, using a provided localized string resource
to create a text view for the label, and a binding to the expansion
state (expanded or collapsed).

[`init(isExpanded:content:label:)`](/documentation/SwiftUI/DisclosureGroup/init(isExpanded:content:label:))

Creates a disclosure group with the given label and content views, and
a binding to the expansion state (expanded or collapsed).



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)