#yew-component #front-end #webasm #web

macro yew-autoprops

proc-macro to automatically derive Properties structs from args for Yew components

6 releases (3 breaking)

0.4.1 Dec 4, 2023
0.4.0 Dec 4, 2023
0.3.0 Oct 30, 2023
0.2.2 May 22, 2023
0.1.0 May 21, 2023

#369 in WebAssembly

Download history 168/week @ 2023-12-18 70/week @ 2023-12-25 86/week @ 2024-01-01 56/week @ 2024-01-08 139/week @ 2024-01-15 70/week @ 2024-01-22 147/week @ 2024-01-29 62/week @ 2024-02-05 210/week @ 2024-02-12 83/week @ 2024-02-19 121/week @ 2024-02-26 161/week @ 2024-03-04 136/week @ 2024-03-11 114/week @ 2024-03-18 78/week @ 2024-03-25 225/week @ 2024-04-01

570 downloads per month

MIT/Apache

13KB
245 lines

yew-autoprops

Crate Info API Docs

proc-macro to automatically derive Properties structs from args for Yew components

No more extra one-off Props structs!

Examples

use yew_autoprops::autoprops;
use yew::prelude::*;

#[autoprops]
#[function_component]
fn CoolComponent(#[prop_or_default] hidden: bool, smth: &AttrValue) -> Html {
    html! {
        <div class={classes!(hidden.then_some("hidden"))}>
            <p>{ smth }</p>
        </div>
    }
}
use yew_autoprops::autoprops;
use yew::prelude::*;

#[autoprops(CoolComponentProps)]
#[function_component(CoolComponent)]
fn cool_component(#[prop_or_default] hidden: bool, smth: &AttrValue) -> Html {
    html! {
        <div class={classes!(hidden.then_some("hidden"))}>
            <p>{ smth }</p>
        </div>
    }
}

Dependencies

~330–780KB
~19K SLoC