Use HTMX to inject a loading spinner #42

Closed
opened 2026-02-15 16:35:52 +00:00 by aniram · 2 comments
Owner
No description provided.
aniram added this to the 2026.1 milestone 2026-02-15 16:35:52 +00:00
aniram added reference feature/loading-spinner-htmx 2026-02-15 16:52:19 +00:00
Author
Owner
https://htmx.org/attributes/hx-indicator/
Author
Owner

HTMX is sexy but it is not the right tool for this job. The request that needs a loading spinner triggers a full rerender of the page and HTMX is made for partial replacement of HTML. I managed to show the loading spinner by listening on the submit of the form and toggling a CSS class that shows the spinner while initially the spinner is hidden, so when the request's response arrives with a full HTML page the spinner will be hidden again.

HTMX is sexy but it is not the right tool for this job. The request that needs a loading spinner triggers a full rerender of the page and HTMX is made for partial replacement of HTML. I managed to show the loading spinner by listening on the submit of the form and toggling a CSS class that shows the spinner while initially the spinner is hidden, so when the request's response arrives with a full HTML page the spinner will be hidden again.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
aniram/cidadon#42
No description provided.