leptonic
leptonic copied to clipboard
Add Attribute Spreading
I think attribute spreading must be added to leptonic.
Attribute spreading was added to leptos
0.6.12
I tried to use this, but it not works for Link
of leptonic
use leptonic::prelude::*;
use leptos::*;
#[component]
pub fn NavLink(
#[prop(into)] link: String,
#[prop(into)] icon: MaybeSignal<icondata::Icon>,
#[prop(into)] text: String,
#[prop(attrs)] attrs: Vec<(&'static str, Attribute)>,
) -> impl IntoView {
view! {
<Link {attr} href=link>
<div class="flex gap-2">
<Icon icon=icon class="text-2xl"/>
<div>{text}</div>
</div>
</Link>
}
}
Then we can use like this;
<NavLink link="/" icon=icondata::BsHouse text="Home" attr:class="w-full"/>
https://docs.rs/leptos_router/latest/src/leptos_router/components/link.rs.html#64
https://github.com/lpotthast/leptonic/blob/6c2959f7336dd80e13a3ae8c05671d05ecd38d02/leptonic/src/components/link.rs#L11
I think it is very important feature and must be quickly added to leptonic