daisyUI v5.6 is now available!

HTMX Tailwind CSS

Use Tailwind CSS and daisyUI with HTMX without class-heavy fragments

HTMX Tailwind CSS

Tailwind CSS works well with HTMX

HTMX keeps interaction in HTML attributes. Tailwind CSS pairs well with that because it also keeps styling in the markup. You can build server-rendered fragments that carry both behavior and presentation without a client framework.

That directness is useful, especially for forms, filters, tables, and inline updates. A fragment can return from the server ready to display and ready to respond to the next interaction.

The trouble is density. hx-* attributes already add meaning to the markup. Long Tailwind CSS class strings beside them can make fragments hard to scan.

HTMX markup can run out of breathing room

An HTMX button may include a URL, target, swap strategy, indicator, disabled state, and accessibility text. Add a long utility chain and the element becomes hard to edit.

LLMs also spend tokens on both sets of attributes. If the goal is to change server interaction, repeated utility classes become expensive background noise.

HTMX + Tailwind CSS + daisyUI

daisyUI shortens repeated UI classes while preserving the HTML-first model.

  • Cleaner attributes: class="btn btn-primary" is easier to read beside hx-post and hx-target.

  • Works with swaps: daisyUI has no JavaScript binding layer, so HTMX can replace fragments freely.

  • Useful fragment components: alert, card, table, modal, and loading cover common server-rendered UI.

  • Tailwind CSS remains precise: Add utilities for one-off layout and responsive behavior.

HTMX keeps behavior declarative. daisyUI makes Tailwind CSS less noisy in the HTML that carries it.

Can't state how much I love daisyUI ♥️

rootkid
Software Developer

I've been *enjoying daisyui* since I discovered it very recently, great job!

Vincent Bergeron
Software Developer

Just revamped my personal website using daisyUI and I'm thrilled with the *simplicity and cleanliness* it brings!

Christian
Ruby on Rails Developer

Adding daisyUI to the front and adding new features to the products really affect all of our metrics.

Manuel Gracia
Developer

Using daisyUI feels like using the old Bootstrap but with the additional power of Tailwind's customization.

Mazipan
Software developer

I cannot thank you enough for daisyUI. It has completely taken over my UIs. It is a breeze to get consistent, great looking user interfaces and quickly!

jogi
Developer

Install Tailwind CSS and daisyUI for HTMX

The HTMX guide uses Tailwind CSS CLI and daisyUI as Node dependencies. Add @import "tailwindcss" and @plugin "daisyui" to your CSS file, build it, and link the generated CSS from your HTML.

For the exact commands, see How to install daisyUI with HTMX.

daisyUI is the most popular
component library for Tailwind CSS

Used by engineers at

Meta Research
Alibaba
Amazon
Adobe
Pepsico
Google Cloud