Showcase for the htmx notification extension.
Classic htmx example (click-to-edit) with a simulated
server using sinon.fakeServer. On save, the server
response includes an HX-Trigger header with an
hx-toast event, which the extension automatically
turns into a notification โ no hx-toast attribute
needed on the button.
HX-Toast / HX-Trigger headersThe simulated server can notify the client by returning special headers in the response, without touching the HTML.
hx-toast / hx-toast-fail attributes
/demo/save is simulated by the server and responds
200 OK, showing the success notification. /demo/save-error
is simulated to respond 500, showing the failure notification.
htmx.toast(...)Notifications appear at the top-center of the screen and stack downward. Once at least one notification is visible, a "dismiss all" button (trash icon) appears above the stack โ hover over it to see the tooltip, or click it to dismiss every visible notification at once.