Replies: 3 comments 5 replies
-
I use Bootstrap 5.3 with htmx with no problems at all. |
Beta Was this translation helpful? Give feedback.
-
a potential problem though, is when bootstrap and htmx are both using javascript to work on the same element, it could happen, I just don't get how the modal example above worked around it, still new to htmx |
Beta Was this translation helpful? Give feedback.
-
Hey,
That's exactly what the modal demo is doing indeed ; notice the button's target: <button
hx-get="/modal"
hx-target="#modals-here"
hx-trigger="click" As no So, this replaces the content of the This is a general rule of thumb to make htmx work with any frontend library ; as long as you don't touch the same elements (or any of its parents), there's no reason to encounter any issue. When you don't have any other choice than mess with the same element as the lib's one, those libraries generally provide fallbacks to manually trigger their UX logic from a script. In this case, you could listen for htmx events and manually trigger those events required to make the lib work as it should. Hope this helps! |
Beta Was this translation helpful? Give feedback.
-
https://htmx.org/examples/modal-bootstrap/ is a demo, but I don't really understand how it avoids possible javascript conflicts between bootstrap5 and htmx? what's the key?
what about other bootstrap5 widgets that use javascript, are there some general rule to follow so I can use bootstrap5+alpine.js+htmx without surprises on the js conflict side?
Beta Was this translation helpful? Give feedback.
All reactions