Skip to main content

Button

Function Button 

Source
pub fn Button<F, G>(
    __arg0: Modifier,
    __arg1: ButtonSpec,
    __arg2: F,
    __arg3: G,
) -> NodeId
where F: FnMut() + 'static, G: FnMut() + 'static,
Expand description

Calls on_click after a click and places content inside a button container. The modifier controls size and appearance. spec can supply an interaction source.

ยงExample

use cranpose_ui::*;

#[composable]
fn SaveAction() {
    Button(
        Modifier::empty().padding(8.0),
        ButtonSpec::default(),
        || println!("Save requested"),
        || {
            Text("Save", Modifier::empty(), TextStyle::default());
        },
    );
}