A choice that can be switched on and off: a filter, a tag to pick. It is a button that is filled with the main action's colour while selected and plain otherwise, and sends what .on_press says; the app flips its state (a row of them can have any number chosen, which the list rows and tabs, one-of-a-group, cannot).
Signature
pub fn chip<M>(label: &str, selected: bool) -> Button<'_, M>Methods
.primary() -> Self— The main action's look..ghost() -> Self— A quiet look: no fill and no outline until the pointer is over it..danger() -> Self— For what cannot be taken back: filled with the danger colour..tonal() -> Self— A softer main action: the brand colour thinned out, with the brand colour for the label..on_press(message: M) -> Self— Sendsmessagewhen pressed..enabled(enabled: bool) -> Self— Whether it can be used (it is by default)..icon_filled(filled: bool) -> Self— Fills in the icon (its closed shapes as well as its outline): a chosen state, a liked heart..icon(icon: fusuma_icons::Icon) -> Self— An icon before the text.
Example
use fusuma::{chip, wrap};
let view = wrap((chip("Rust", true).on_press(0), chip("C++", false).on_press(1)));
let built = fusuma::doc::built::<i32, _>(&view);
assert_eq!(built.texts(), ["Rust", "C++"]);