dioxus/examples/form.rs

25 lines
591 B
Rust
Raw Normal View History

2022-02-04 02:13:35 -05:00
//! Forms
//!
2022-02-04 02:13:35 -05:00
//! Dioxus forms deviate slightly from html, automatically returning all named inputs
//! in the "values" field
use dioxus::prelude::*;
fn main() {
dioxus::desktop::launch(app);
}
fn app(cx: Scope) -> Element {
cx.render(rsx! {
div {
h1 { "Form" }
form {
2022-02-04 02:13:35 -05:00
oninput: move |ev| println!("{:?}", ev.values),
input { r#type: "text", name: "username" }
input { r#type: "text", name: "full-name" }
input { r#type: "password", name: "password" }
}
}
})
}