thaw/gh-pages/src/pages/checkbox/mod.rs

54 lines
1.7 KiB
Rust
Raw Normal View History

2023-10-03 15:57:35 +08:00
use std::collections::HashSet;
2023-09-21 22:59:35 +08:00
use crate::components::{Demo, DemoCode};
2023-06-13 12:43:15 +08:00
use leptos::*;
use melt_ui::*;
2023-10-04 00:11:38 +08:00
use prisms::highlight_str;
2023-06-13 12:43:15 +08:00
#[component]
2023-08-29 09:11:22 +08:00
pub fn CheckboxPage() -> impl IntoView {
let checked = create_rw_signal(false);
2023-10-03 15:57:35 +08:00
let value = create_rw_signal(HashSet::new());
2023-08-29 09:11:22 +08:00
view! {
2023-09-21 22:59:35 +08:00
<div style="width: 896px; margin: 0 auto;">
<h1>"Checkbox"</h1>
<Demo>
<Checkbox checked>
"Click"
</Checkbox>
2023-10-04 00:11:38 +08:00
<DemoCode slot html=highlight_str!(r#"
let checked = create_rw_signal(false);
2023-09-21 22:59:35 +08:00
2023-10-04 00:11:38 +08:00
<Checkbox checked>
"Click"
</Checkbox>
"#, "rust")>
""
2023-09-21 22:59:35 +08:00
</DemoCode>
</Demo>
2023-10-03 17:57:37 +08:00
<h3>"group"</h3>
2023-10-03 15:57:35 +08:00
<Demo>
<CheckboxGroup value>
<CheckboxItem label="apple" value="a" />
<CheckboxItem label="b" value="b" />
<CheckboxItem label="c" value="c" />
</CheckboxGroup>
<div style="margin-top: 1rem">
"value: " { move || format!("{:?}", value.get()) }
</div>
2023-10-04 00:11:38 +08:00
<DemoCode slot html=highlight_str!(r#"
let value = create_rw_signal(HashSet::new());
2023-10-03 15:57:35 +08:00
2023-10-04 00:11:38 +08:00
<CheckboxGroup value>
<CheckboxItem label="apple" value="a" />
<CheckboxItem label="b" value="b" />
<CheckboxItem label="c" value="c" />
</CheckboxGroup>
"#, "rust")>
""
2023-10-03 15:57:35 +08:00
</DemoCode>
</Demo>
2023-06-13 12:43:15 +08:00
</div>
}
}