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.
Interactive Reference
Live showroom
Need the full visual surface?
Screenshots do not scale well across every component, state, and variant. For the real interactive reference, import the package and launch DSShowcaseRoot().
Best for exploring:
variants, states, categories, and real app examples in one place.
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)
}
}