File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ #if canImport(AndroidSwiftUI)
2+ import AndroidSwiftUI
3+ #else
4+ import SwiftUI
5+ #endif
6+
7+ struct DisclosurePlayground : View {
8+
9+ @State private var advancedOpen = false
10+
11+ var body : some View {
12+ ScrollView {
13+ VStack ( alignment: . leading, spacing: 0 ) {
14+ Example ( " Self-managed expansion " ) {
15+ DisclosureGroup ( " What's included " ) {
16+ Text ( " • Unlimited projects " )
17+ Text ( " • Priority support " )
18+ Text ( " • Early access " )
19+ }
20+ }
21+ Example ( " Bound expansion " ) {
22+ VStack ( alignment: . leading, spacing: 8 ) {
23+ DisclosureGroup ( " Advanced settings " , isExpanded: $advancedOpen) {
24+ Text ( " Experimental features live here. " )
25+ Toggle ( " Beta channel " , isOn: . constant( true ) )
26+ }
27+ Button ( advancedOpen ? " Collapse from outside " : " Expand from outside " ) {
28+ advancedOpen. toggle ( )
29+ }
30+ }
31+ }
32+ Example ( " With a Label header " ) {
33+ DisclosureGroup ( content: {
34+ Text ( " Grouped under a labeled header. " )
35+ } , label: {
36+ Label ( " Notifications " , systemImage: " star.fill " )
37+ } )
38+ }
39+ }
40+ }
41+ . navigationTitle ( " DisclosureGroup " )
42+ }
43+ }
You can’t perform that action at this time.
0 commit comments