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 html_attrs macro #1

Open
DanielleHuisman opened this issue Oct 1, 2024 · 0 comments
Open

Add html_attrs macro #1

DanielleHuisman opened this issue Oct 1, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@DanielleHuisman
Copy link
Member

DanielleHuisman commented Oct 1, 2024

Add a html_attrs macro that expands to the usual Yew html macro, but with support for dynamic attributes. This would greatly improve the syntax and user experience.

For example:

html_attrs! {
    <Button attr:disabled=false attr:onclick={on_click}>Toggle</Button>
}

Which would expand to:

html! {
    <Button attrs={attrs! { disabled=false onclick={on_click} }}>Toggle</Button>
}

I'm not sure if this is feasible, but it would be a way nicer syntax (similar to Leptos).

@DanielleHuisman DanielleHuisman added the enhancement New feature or request label Oct 1, 2024
@DanielleHuisman DanielleHuisman changed the title Add html_attrs macro Add html_attrs macro Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant