Fusuma

Components / Components

rating

Five stars, the first value of them filled; pressing the n-th sends on_rate(n) (pressing the one that is already the value is the app's to treat as clearing it).

Try it

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

Live: Data, where rating is usedOpen full size

Also on this pagespinnerkbdcarouseltimelinetableline_chartarea_chartbar_chart

Five stars, the first value of them filled; pressing the n-th sends on_rate(n) (pressing the one that is already the value is the app's to treat as clearing it).

Signature

pub fn rating<'a, M: Clone + 'a>(value: u8, on_rate: fn(u8) -> M) -> impl View<M> + 'a

Example

use fusuma::rating;
let stars = 3;
let view = rating(stars, |n| n);
let built = fusuma::doc::built::<u8, _>(&view);
assert_eq!(built.texts(), ["*", "*", "*", "*", "*"]);

All components · Source