Fusuma

Components / Components

accordion

A heading that opens and closes what is under it: the heading is a button (filled while open), the body is kept and hidden when closed, so what is in it keeps its state.

Try it

This is the Pickers page of the gallery, running in your browser: accordion is on it, and it is the real widget. Press Run, then use it.

Live: Pickers, where accordion is usedOpen full size

Also on this pagecalendartime_pickersplit_viewselecttree_item

A heading that opens and closes what is under it: the heading is a button (filled while open), the body is kept and hidden when closed, so what is in it keeps its state. on_toggle is what pressing the heading sends; the app flips open.

Signature

pub fn accordion<'a, M: Clone + 'a, C: Children<M> + 'a>( title: &'a str, open: bool, on_toggle: M, body: C, ) -> impl View<M> + 'a

Example

use fusuma::{accordion, text};
let view = accordion("Details", false, (), (text("Hidden until opened"),));
let built = fusuma::doc::built::<(), _>(&view);
assert_eq!(built.texts(), ["Details", "Hidden until opened"]);

All components · Source