Implement mockup of chips component #15

Merged
BobdaFett merged 7 commits from feature/chips-component into main 2025-10-23 15:56:48 +00:00
Showing only changes of commit a01a5a83d7 - Show all commits
+9 -2
View File
@@ -28,13 +28,20 @@ pub fn Chip(
#[prop()] checked: Signal<bool>,
#[prop(optional)] disabled: RwSignal<bool>,
) -> impl IntoView {
// Generate a unique id - ensure that the value doesn't contain spaces.
// Without this id, checkbox/radio inputs can interfere with each other.
let value_no_spaces = value.clone().chars()
.filter(|c| !c.is_whitespace())
.collect::<String>();
let id = format!("{}-{}", name.clone(), value_no_spaces);
view! {
<label for=value>
<label for=id>
<input
type="checkbox"
class="relative peer shrink-0 hidden"
name=name.clone()
id=value.clone()
id=id.clone()
prop:checked=checked
on:change=move |_| on_change.run(())
disabled=disabled />