7 releases (4 breaking)
| 0.5.0 | Mar 16, 2026 |
|---|---|
| 0.4.1 | Dec 4, 2023 |
| 0.3.0 | Oct 30, 2023 |
| 0.2.2 | May 22, 2023 |
| 0.1.0 | May 21, 2023 |
#1500 in WebAssembly
1,356 downloads per month
17KB
249 lines
yew-autoprops
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]
#[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)]
#[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
~96–440KB
~11K SLoC