Source chip
Mono chips that name the files behind an answer or summary. With on_click they become buttons that open the source.
Nine of twelve interviewees raised onboarding.
support inbox
Opened: nothing yet
Usage
use hydroxy_leptos::icon::IconName;
use hydroxy_leptos::source_chip::{SourceChip, SourceRow};
use leptos::prelude::*;
pub fn demo() -> AnyView {
let (opened, set_opened) = signal(String::from("nothing yet"));
view! {
<div style="display: grid; gap: var(--space-5);">
<p style="margin: 0; font: var(--text-body);">"Nine of twelve interviewees raised onboarding."</p>
<SourceRow>
<SourceChip on_click=move || set_opened.set("interviews-q3.pdf".into())>"interviews-q3.pdf"</SourceChip>
<SourceChip on_click=move || set_opened.set("tickets-sept.csv".into())>"tickets-sept.csv · p. 4"</SourceChip>
<SourceChip icon=IconName::Inbox>"support inbox"</SourceChip>
</SourceRow>
<p style="margin: 0; font: var(--text-sm); color: var(--text-2);">"Opened: " {opened}</p>
</div>
}
.into_any()
}use dioxus::prelude::*;
use hydroxy_dioxus::icon::IconName;
use hydroxy_dioxus::source_chip::{SourceChip, SourceRow};
#[component]
pub fn SourceChipDemo() -> Element {
let mut opened = use_signal(|| String::from("nothing yet"));
rsx! {
div { style: "display: grid; gap: var(--space-5);",
p { style: "margin: 0; font: var(--text-body);", "Nine of twelve interviewees raised onboarding." }
SourceRow {
SourceChip { on_click: move |()| opened.set("interviews-q3.pdf".into()), "interviews-q3.pdf" }
SourceChip { on_click: move |()| opened.set("tickets-sept.csv".into()), "tickets-sept.csv · p. 4" }
SourceChip { icon: IconName::Inbox, "support inbox" }
}
p { style: "margin: 0; font: var(--text-sm); color: var(--text-2);", "Opened: {opened}" }
}
}
}
Anatomy
| Component | data-part | Renders |
|---|---|---|
SourceChip | — | span, or a button with on_click |
SourceRow | — | Wrapping group, labelled "Sources" |
Props
| Prop | Type | Notes |
|---|---|---|
children | View | The source's name |
icon | IconName | Leading icon. Default FileText |
on_click | Callback<()> | Opens the source |