dioxus/examples/disabled.rs

22 lines
415 B
Rust
Raw Normal View History

2022-01-08 02:10:47 -05:00
use dioxus::prelude::*;
fn main() {
2024-01-20 00:11:55 -08:00
launch(app);
2022-01-08 02:10:47 -05:00
}
fn app() -> Element {
let mut disabled = use_signal(|| false);
2022-01-08 02:10:47 -05:00
2024-01-16 13:18:46 -06:00
rsx! {
2022-01-08 02:10:47 -05:00
div {
2024-01-15 13:06:05 -08:00
button { onclick: move |_| disabled.toggle(),
2022-03-01 02:50:03 -05:00
"click to "
if disabled() { "enable" } else { "disable" }
2022-03-01 02:50:03 -05:00
" the lower button"
2022-01-08 02:10:47 -05:00
}
2024-01-15 13:06:05 -08:00
button { disabled, "lower button" }
2022-01-08 02:10:47 -05:00
}
2024-01-13 21:12:21 -08:00
}
2022-01-08 02:10:47 -05:00
}