Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Attribute Spreading #70

Open
over-light opened this issue Jun 27, 2024 · 1 comment
Open

Add Attribute Spreading #70

over-light opened this issue Jun 27, 2024 · 1 comment

Comments

@over-light
Copy link

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

@ActuallyHappening
Copy link

I 100% concur, you currently can't set type = "submit" on the Button component as provided by leptonic currently

If I get the time, I'll try to add this feature, but as @over-light said this should be added since it is stabilised in Leptos already!
but I guess 0.7 will roll around anyway

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants