A button with text, secondary until Button::primary.
Press it with a pointer, a finger, or Enter and Space on the focused button; .on_press(message) says what is sent. .primary(), .ghost(), .danger() and .tonal() change its variant, .icon(..) puts an icon before the text, .enabled(false) greys it out.
Signature
pub const fn button<M>(text: &str) -> 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::{button, row};
#[derive(Clone)]
enum Msg { Save, Cancel }
let view = row((
button("Cancel").on_press(Msg::Cancel),
button("Save").primary().on_press(Msg::Save),
));
let built = fusuma::doc::built::<Msg, _>(&view);
assert_eq!(built.texts(), ["Cancel", "Save"]);