Skip to content

Instantly share code, notes, and snippets.

@wjkoh
Last active August 21, 2025 07:52
Show Gist options
  • Select an option

  • Save wjkoh/152adbad3acf30d7d4f9b01f72748a37 to your computer and use it in GitHub Desktop.

Select an option

Save wjkoh/152adbad3acf30d7d4f9b01f72748a37 to your computer and use it in GitHub Desktop.
HTMX + Alpine.js: Displaying HTTP Errors Using the HTML <dialog> Element
<!-- Copy and paste the following to every html file. -->
<div x-data="{ open: false, title: '', content: '' }"
x-on:htmx:response-error.window="title = $event.detail.xhr.statusText; content = $event.detail.xhr.responseText; open = true">
<dialog x-bind:open="open">
<article>
<h2>Error: <span x-text="title"></span></h2>
<p><code x-text="content"></code></p>
<footer>
<button x-on:click="open = false">OK</button>
</footer>
</article>
</dialog>
</div>
@wjkoh
Copy link
Author

wjkoh commented Aug 21, 2025

Example:
Edit-Noah-Holdings-Limited-Q1-2025-Earnings-Call-·-Fred-08-21-2025_05_48_PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment