layout/DSAccordion

DSAccordion

layout
since v2.0

Expandable/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

PropTypeDefaultDescription
titlereqStringHeader label.
isExpandedBinding<Bool>?nilExternal control. nil = self-managed.
iconString?nilOptional leading icon.
contentreqViewBuilderCollapsed 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)
    }
}

Related Components