Skip to content

Component Disclosure

MeowLynxSea edited this page Jun 18, 2026 · 5 revisions

Disclosure

A collapsible header. Toggles a panel of children open / closed.

use yororen_ui::headless::disclosure::disclosure;

disclosure("advanced", cx)
    .open(self.show_advanced)
    .on_toggle({
        let entity = cx.entity();
        move |new, _, cx| entity.update(cx, |s, _| s.show_advanced = new);
    })
    .child(/* the body that gets collapsed */)
    .render(cx)

Props

Method Purpose
open(v) Current open/closed state.
disabled(v) Disable the toggle.
on_toggle(closure) Fn(bool, &mut Window, &mut App) + 'static + Send + Sync.
child(el) The body the renderer collapses/hides based on open.

Factory takes (id, _cx). .render(cx) returns Stateful<Div>. No state entity — the parent view owns the boolean.

See also: Modal, Popover.

Clone this wiki locally