You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am looking for a way to output template-parts for returning html for the HTMX framework.
'With Twack, an alternative Ajax view can be created.' How hard would it be, and how would you go about, building a HTMX-api?
Something like calling /htmxapi/component?parameters, and then have it return html to be parsed with HTMX?
The text was updated successfully, but these errors were encountered:
Hi @spoetnik
Thank you for your input! I do not have any experience with HTMX, but I guess what you need is outputting a different format when requested? I already have the ajax (JSON) output switch in place, which checks whether its an api call or a classic page call where HTML should be returned. But it could be worth a thought to make components able to respond correctly to different content type requests. Would HTMX output look like "normal" HTML with special attributes, or is it a totally other format?
HTMX returns just the HTML to replace a part of the DOM. So not the whole page, bust just parts. The htmx library inserts that into the DOM.
It would be nice to have a way to just return the HTML of a component.
As Twack uses components, and has some interface with an API-layer I thought maybe this would be a great start?
Maybe this could better be a brainstorm in the forum? Or is Github the best place?
You are right, maybe it is better to discuss this further in the forum. Since it's your question - do you mind to post the question there again and mention me? I will leave this issue open so I have something where future commits can be linked to.
Sebiworld
changed the title
Question: HTMX output of components
Feature-Request: HTMX output of components - Optional partial output of a page
Feb 4, 2024
I am looking for a way to output template-parts for returning html for the HTMX framework.
'With Twack, an alternative Ajax view can be created.' How hard would it be, and how would you go about, building a HTMX-api?
Something like calling /htmxapi/component?parameters, and then have it return html to be parsed with HTMX?
The text was updated successfully, but these errors were encountered: