Fusuma

Components / Components

carousel

One page of total at a time, with arrows and dots under it: content is the current page's view, on_page what an arrow sends (the page it goes to, held to the ends).

Try it

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

Live: Data, where carousel is usedOpen full size

Also on this pagespinnerkbdratingtimelinetableline_chartarea_chartbar_chart

One page of total at a time, with arrows and dots under it: content is the current page's view, on_page what an arrow sends (the page it goes to, held to the ends).

Signature

pub fn carousel<'a, M: Clone + 'a, V: View<M> + 'a>( index: usize, total: usize, on_page: fn(usize) -> M, content: V, ) -> impl View<M> + 'a

Example

use fusuma::{carousel, text};
let page = 1;
let view = carousel(page, 3, |to| to, text("Page two"));
let built = fusuma::doc::built::<usize, _>(&view);
assert!(built.texts().contains(&"Page two"));

All components · Source