dioxus/examples/disabled.rs

29 lines
572 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 {
let disabled = use_state(&cx, || false);
cx.render(rsx! {
div {
button {
onclick: move |_| disabled.set(!disabled.get()),
"click to " [if *disabled {"enable"} else {"disable"} ] " the lower button"
}
button {
disabled: "{disabled}",
"lower button"
}
2022-01-08 18:02:23 +00:00
input {
value: "false",
}
2022-01-08 07:10:47 +00:00
}
})
}