Merge pull request #973 from Icekey/select_example

added select element example
This commit is contained in:
Jon Kelley authored and GitHub committed 2023-05-04 11:10:33 -07:00
commit b632bf182b
1 file changed
+32
+32
View File
@@ -37,6 +37,7 @@ const FIELDS: &[(&str, &str)] = &[
fn app(cx: Scope) -> Element {
cx.render(rsx! {
div { margin_left: "30px",
select_example(cx),
div {
// handling inputs on divs will catch all input events below
// so the value of our input event will be either huey, dewey, louie, or true/false (because of the checkboxe)
@@ -134,3 +135,34 @@ fn app(cx: Scope) -> Element {
}
})
}
fn select_example(cx: Scope) -> Element {
cx.render(rsx! {
div {
select {
id: "selection",
name: "selection",
multiple: true,
oninput: move |evt| {
println!("{evt:?}");
},
option {
value : "Option 1",
label : "Option 1",
}
option {
value : "Option 2",
label : "Option 2",
selected : true,
},
option {
value : "Option 3",
label : "Option 3",
}
}
label {
r#for: "selection",
"select element"
}
}})
}