layout/DSAccordion
DSAccordion
layoutExpandable/collapsible content section with a header and animated disclosure.
iOS 17+macOS 14+
Purpose
FAQ sections, advanced settings, and collapsible detail panels.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| titlereq | String | — | Header label. |
| isExpanded | Binding<Bool>? | nil | External control. nil = self-managed. |
| icon | String? | nil | Optional leading icon. |
| contentreq | ViewBuilder | — | Collapsed content. |
Examples
FAQ
Frequently asked questions list.
swift
ForEach(faqs) { faq in
DSAccordion(title: faq.question) {
DSText(faq.answer, style: .body)
.padding(.vertical, DSSpacing.sm)
}
}