Trending Tech: HTMX
Tags: html, webdev, programming, ajax
Published: 2023-09-21 01:16:14

**DEFINITION**

> _htmx gives you access to AJAX, CSS Transitions, WebSockets and Server Sent Events directly in HTML, using attributes, so you can build modern user interfaces with the simplicity and power of hypertext - [htmx.org](htmx.org)_

I first heard of this technology from [Siegfried, deploy! podcast](https://bleech.de/en/siegfried-deploy-podcast/), [episode #41](https://youtu.be/kPP_TQFPfU8?si=DdrQDxGOP5BtuPZ8). Didn’t think too much about it until another recent article came up in my feed today from [Infoworld](https://www.infoworld.com/article/3706951/htmx-dynamic-html-without-the-javascript.html). This got me thinking about the uniqueness of HTML attributes again. Adding those extra bits of HTML markup really helps define the boundaries of what the front-end has to offer.

I do recall, lines and lines of thick HTML code that were laced into an open-source project. In the past attributes have been used for a variety of things for the front-end. From, [data attributes](https://developer.mozilla.org/en-US/docs/Learn/HTML/Howto/Use_data_attributes) that tie in nicely with JavaScript for special functionalities, to [ARIA attributes](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes) for accessibility purposes.

Then there is the massive additional [HTML attributes library](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes). It almost feels like, attributes is an ongoing extension of HTML, minus the bloated JavaScript libraries that we all know and love today.

**LESS OVERHEAD, PERHAPS?**

Going back to server-side rendered, with just a simple call through HTML markup? Didn’t the web community spend over half a decade perfecting front-end loaded frameworks such as React.js, Vue.js, etc. in order to offload functional components on the client side?

Aren’t we going backward here? An avid Drupal friend of mine said, “what else is new hmm. isn’t that just isomorphic.” He mentioned that this was [already somewhat of a thing baked into Drupal 8.3](https://www.drupal.org/docs/8/core/modules/big-pipe/overview).

Out with the old…in with the…old? It is possible but with a twist!

AJAX requests are a popular method for pinging the server, whenever needed. A great example is the use of Google Maps. You don’t need the whole map unless you move the cursor to a new spot. This then grabs the data from the server again. Here’s where the HTMX [hx-trigger attribute](https://htmx.org/attributes/hx-trigger/) comes into play.

There’s something called Standard Event Filter, which is like a call to a JavaScript library, then you can add an additional boolean bracket to the attribute called Standard Event Modifier to enhance its behavior after the event.

This is just one interesting aspect of the technology that made sense to me. It is still new to me, but intriguing nonetheless because it modifies HTML.

**KEEP ME APPRISED**

I’ll be sure to keep HTMX on my tech radar. There are already so many new things happening within the front-end space, that it is hard to keep up. I can go down a reference rabbit hole with new [CSS nesting](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_nesting/Using_CSS_nesting), but let’s save that for another post!

This was initially published on my site at [jameslau.com](https://jameslau.com/trending-tech-htmx/). Please come by and check out more of my writing and other works!

Thanks for reading!