Skip to content
Discussion options

You must be logged in to vote

Thanks for the follow-up! I had misread your earlier comment. If your question is just about adding custom attributes (for Datastar/HTMX etc.), you can do that via the Attributes field in the props.

Example:

@button.Button(button.Props{
    Variant:    button.VariantSecondary,
    Attributes: templ.Attributes{
        "data-on-click": "@patch('/examples/click_to_edit/reset')",
        "data-attr-disabled": "$_fetching",
    },
}) {
    Reset
}

📚 References:

That way you can pass through any Datastar/HTMX attributes directly to the component.

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@nickchomey
Comment options

@ionv06
Comment options

@axadrn
Comment options

Answer selected by nickchomey
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants