dioxus/examples/disabled.rs

26 lines
513 B
Rust
Raw Normal View History

2022-01-08 07:10:47 +00:00
use dioxus::prelude::*;
fn main() {
dioxus_desktop::launch(app);
2022-01-08 07:10:47 +00:00
}
fn app() -> Element {
2024-01-14 05:12:21 +00:00
let disabled = use_signal(|| false);
2022-01-08 07:10:47 +00:00
2024-01-14 05:12:21 +00:00
rsx! {
2022-01-08 07:10:47 +00:00
div {
button {
2022-03-01 07:50:03 +00:00
onclick: move |_| disabled.set(!disabled),
"click to "
if disabled == true { "enable" } else { "disable" }
2022-03-01 07:50:03 +00:00
" the lower button"
2022-01-08 07:10:47 +00:00
}
button {
disabled: "{disabled}",
"lower button"
}
}
2024-01-14 05:12:21 +00:00
}
2022-01-08 07:10:47 +00:00
}