-
Notifications
You must be signed in to change notification settings - Fork 22
Closed
Description
Say I have a component; for example, a wrapper around an <a> tag that adds commonly used HTMX attributes. I would like to also allow the caller to define the ID & classes, and other attributes on the tag, without having to list all possible attributes in the component definition.
#[component]
fn htmx_link<'a, R: Renderable>(url: &'a str, children: &R) -> impl Renderable {
maud! {
a
/* how do I accept the id/classes here... */
href=(url)
hx-get=(url)
hx-push-url=true
hx-swap="none"
hx-target={"#" (target)}
{ (children) }
}
}
// elsewhere....
maud! {
HtmxLink #i-still-want .to-customize[this == "stuff"] url="my/link" { "clicky" }
}It would also be nice if I could use the native maud syntax for the IDs, classes, optional/conditional attributes, etc. (as I've done above), but having any way to pass in a list of "extra" attributes that are arbitrarily applied to the underlying tag would be wonderful.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels