How to Integrate HTMX and Shoelace Web Components

In my last post, Shoelace Web Components with ASP.NET Core, I showed ASP.NET Core developers how to integrate the web components of Shoelace into an existing web application. It's incredible, and you should check it out.

This technical article explains the challenges of integrating the HTMX library with Shoelace web components , which use the Shadow DOM. It details why HTMX (pre-2.0) cannot directly interact with Shoelace elements and provides a solution using HTMX events to ensure form submissions and dynamic behaviors work correctly.
How to Integrate HTMX and Shoelace Web Components

HTMX doesn't scan the Shadow DOM of custom web components like those from Shoelace , meaning form inputs inside Shoelace components are silently excluded from...
In my last post, Shoelace Web Components with ASP.NET Core, I showed ASP.NET Core developers how to integrate the web components of Shoelace into an existing web application.
Shoelace Articles
How to Integrate HTMX and Shoelace Web Components A guide to resolving compatibility issues between HTMX and Shoelace web components , with a focus on Shadow DOM and event handling.
Shoelace is a popular and mature collection of configurable Web Components , which by definition are framework agnostic. Since writing our own components library is a ton of work, we should rather prefer using something ready and battle tested. Let's then see how this library plays with HTMX by building a real application!

htmx Examples Web Components
Web Components This example shows how to integrate HTMX with web components , allowing it to be used inside of shadow DOM. By default, HTMX doesn't know anything about your web components , and won't see anything inside their shadow DOM. Because of this, you'll need to manually tell HTMX about your component's shadow DOM by using htmx ...
Shoelace is a popular and mature collection of configurable Web Components and as we already know, HTMX pairs really nicely with Web Components .

Key Details About How To Integrate Htmx And Shoelace Web Components
Shoelace is now Web Awesome! Web Awesome has an even bigger library of free components . Plus themes, utilities, patterns, and more! Still open source. Still free. With more Awesome. Migrate to Web Awesome! No, thanks Shoelace Is Sunset with no active development Use Web Awesome for ongoing work, issues, and features.







Add " shoelace " to the hx-ext parameter on a form or body tag. Adding it to the body tag will make all forms in the page include the values of Shoelace elements within them.