https://github.com/yewstack/yew-autoprops
https://github.com/yewstack/yew-autoprops
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/yewstack/yew-autoprops
- Owner: yewstack
- License: apache-2.0
- Created: 2023-05-21T19:51:05.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-12-04T15:37:26.000Z (about 2 years ago)
- Last Synced: 2025-08-15T18:25:27.735Z (4 months ago)
- Language: Rust
- Size: 23.4 KB
- Stars: 10
- Watchers: 7
- Forks: 2
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# yew-autoprops
proc-macro to automatically derive Properties structs from args for Yew components
No more extra one-off Props structs!
# Examples
```rust
use yew_autoprops::autoprops;
use yew::prelude::*;
#[autoprops]
#[function_component]
fn CoolComponent(#[prop_or_default] hidden: bool, smth: &AttrValue) -> Html {
html! {
{ smth }
}
}
```
```rust
use yew_autoprops::autoprops;
use yew::prelude::*;
#[autoprops(CoolComponentProps)]
#[function_component(CoolComponent)]
fn cool_component(#[prop_or_default] hidden: bool, smth: &AttrValue) -> Html {
html! {
{ smth }
}
}
```