wip: move examples around
This commit is contained in:
1 parent
d298b626d3
commit
1e6e5e611b
86 files changed
+160
-216
No files matched your search
@@ -0,0 +1,37 @@
|
||||
use dioxus::prelude::*;
|
||||
fn main() {}
|
||||
|
||||
pub static Example: FC<()> = |(cx, props)| {
|
||||
cx.render(rsx! {
|
||||
div {
|
||||
|
||||
}
|
||||
})
|
||||
};
|
||||
|
||||
// A controlled component:
|
||||
static ControlledSelect: FC<()> = |(cx, props)| {
|
||||
let value = use_state(cx, || String::from("Grapefruit"));
|
||||
cx.render(rsx! {
|
||||
select { value: "{value}", onchange: move |evt| value.set(evt.value()),
|
||||
option { value: "Grapefruit", "Grapefruit"}
|
||||
option { value: "Lime", "Lime"}
|
||||
option { value: "Coconut", "Coconut"}
|
||||
option { value: "Mango", "Mango"}
|
||||
}
|
||||
})
|
||||
};
|
||||
|
||||
// TODO - how do uncontrolled things work?
|
||||
static UncontrolledSelect: FC<()> = |(cx, props)| {
|
||||
let value = use_state(cx, || String::new());
|
||||
|
||||
cx.render(rsx! {
|
||||
select {
|
||||
option { value: "Grapefruit", "Grapefruit"}
|
||||
option { value: "Lime", "Lime"}
|
||||
option { value: "Coconut", "Coconut"}
|
||||
option { value: "Mango", "Mango"}
|
||||
}
|
||||
})
|
||||
};
|
||||
Reference in new issue
Block a user