Skip to content

Commit 3d90a26

Browse files
committed
feat: add disabled example
1 parent 8d685f4 commit 3d90a26

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

examples/disabled.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
use dioxus::prelude::*;
2+
3+
fn main() {
4+
dioxus::desktop::launch(app);
5+
}
6+
7+
fn app(cx: Scope) -> Element {
8+
let disabled = use_state(&cx, || false);
9+
10+
cx.render(rsx! {
11+
div {
12+
button {
13+
onclick: move |_| disabled.set(!disabled.get()),
14+
"click to " [if *disabled {"enable"} else {"disable"} ] " the lower button"
15+
}
16+
17+
button {
18+
disabled: "{disabled}",
19+
"lower button"
20+
}
21+
}
22+
})
23+
}

0 commit comments

Comments
 (0)