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

Feature-Request: HTMX output of components - Optional partial output of a page #2

Open
spoetnik opened this issue Jan 28, 2024 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@spoetnik
Copy link

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?

@Sebiworld
Copy link
Owner

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?

@spoetnik
Copy link
Author

spoetnik commented Feb 3, 2024

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?

@Sebiworld
Copy link
Owner

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 Sebiworld changed the title Question: HTMX output of components Feature-Request: HTMX output of components - Optional partial output of a page Feb 4, 2024
@Sebiworld Sebiworld self-assigned this Feb 4, 2024
@Sebiworld Sebiworld added the enhancement New feature or request label Feb 4, 2024
@spoetnik
Copy link
Author

spoetnik commented Feb 4, 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

2 participants