dioxus/examples/disabled.rs

24 lines
514 B
Rust
Raw Normal View History

2022-01-08 07:10:47 +00:00
use dioxus::prelude::*;
fn main() {
dioxus::desktop::launch(app);
}
fn app(cx: Scope) -> Element {
2022-01-26 02:41:40 +00:00
let (disabled, set_disabled) = use_state(&cx, || false);
2022-01-08 07:10:47 +00:00
cx.render(rsx! {
div {
button {
2022-01-26 02:41:40 +00:00
onclick: move |_| set_disabled(!disabled),
"click to " [if *disabled {"enable"} else {"disable"} ] " the lower button"
2022-01-08 07:10:47 +00:00
}
button {
disabled: "{disabled}",
"lower button"
}
}
})
}