Server-driven UI components for htmx
A small Tailwind CSS component library for apps where the server renders HTML. Copy the markup, swap fragments with htmx, and theme everything with a handful of CSS variables.
bun create htmx-ui my-site
npm create htmx-ui my-site
pnpm create htmx-ui my-site
yarn create htmx-ui my-site
Why HTMX UI
Components that respect the server
Everything you need to ship a polished hypermedia app, and nothing that fights it.
Just HTML
Components are CSS classes and data attributes. No virtual DOM, no client framework, no build-time JSX.
htmx-aware
Behaviour initialises on new content after every htmx swap, so components work inside server-rendered fragments.
Themeable by variables
Every colour and radius is a CSS variable mapped into Tailwind v4. Override a few and the whole kit follows.
Dark mode built in
A class-based dark variant, token swaps and a no-flash theme switcher that follows the OS until you choose.
Tailwind v4 native
Built with @apply in @layer components, so your utilities still win and unused styles are tree-shaken.
Small and idempotent
Each behaviour is a few lines of TypeScript that marks what it touched, so running it twice is harmless.
- Components
- 61
- Categories
- 9
- Server adapters
- 5
- First-party plugins
- 3
Components
Categories
Server adapters
First-party plugins
Components
Forms, toggles, menus and more
Everything below is live: click, type and toggle. It is the same markup you get from the docs.
Editor toolbar
Toggles, a button group and a split button with a dropdown.
Do I need a JavaScript framework?
No. Components are CSS classes; a few have small behaviours that re-run after htmx swaps.
Does this accordion use JavaScript?
No, it's a native <details> element. Only one item opens at a time because they share a name.
Can I theme it?
Every colour and the radius are CSS variables. Override a few and everything follows.
Live
Fragments in, components ready
The button below asks the server for an HTML fragment. When it lands, htmx swaps it in and htmx-ui wires up any components inside it. That includes the dismissible alert it returns.
htmx request
Dev serverhx-get="/api/hello" → hx-target="#hello"
Start here
Read one page, ship something
Start building in a couple of minutes
Install the package, import one stylesheet, and call one function.
bun add htmx-ui htmx.org
npm install htmx-ui htmx.org
pnpm add htmx-ui htmx.org
yarn add htmx-ui htmx.org