Skip to main content

section_expanded

Function section_expanded 

Source
pub fn section_expanded(
    is_expanded: &BoundState<bool>,
    header: &ViewHandle,
    content: &ViewHandle,
) -> ViewHandle
Expand description

Section(isExpanded:) { … } header: { … } — a section that collapses.

The disclosure state is a Binding<Bool> over Rust state, so the section opens and closes by itself and whatever is bound sees it — which is the point of taking a binding rather than an initial value.

Unlike section, the header here is a closure, not a value: this initialiser takes content: and header: as two () -> some View, so both travel as a function-and-context pair rather than as an @in address.