Skip to content

Add html_attrs macro #1

Description

@DanielleHuisman

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).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions