GitHub

HTMX Integration

UX is framework-agnostic. Every component is pure CSS — you control state with data-state attributes, which HTMX can set via hx-on events. Here are real-world patterns.

Setup

<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/ERPlora/ux@3/dist/ux.min.css">
<script src="https://unpkg.com/htmx.org@2"></script>

Modal — Load Content & Open

Preview

Form — Submit with Loading State

Preview

Searchbar — Live Search with Debounce

Preview
MacBook Pro 16" In Stock
iPad Air Low Stock
AirPods Pro In Stock

Tabs — Lazy Load Content per Tab

Preview

Select a tab to load its content...

DataTable — Server-Side Pagination & Sort

Preview
Name ↕ Email ↕ Role
Ana Garcíaana@example.comAdmin
Carlos Lópezcarlos@example.comUser
María Ruizmaria@example.comUser

Infinite Scroll — Load More on Reveal

Preview
AG
Ana García Updated the project settings
2m ago
CL
Carlos López Pushed 3 commits to main
5m ago
MR
María Ruiz Created a new branch feature/auth
12m ago

Toast — Server-Sent Notifications

Preview

Sheet — Slide-Up with Dynamic Content

Preview

Order Details

Delete Confirmation — Alert Dialog

Preview

HTMX Tips with UX

State Management Pattern

Use data-state="open|closed" for all overlays. Toggle with HTMX events:

hx-on::after-swap="document.getElementById('my-modal').dataset.state='open'"
hx-on::after-request="this.closest('[data-state]').dataset.state='closed'"
Loading Indicators

Use htmx-indicator class with UX spinners:

<div class="spinner spinner-sm htmx-indicator"></div>

Or toggle .btn-loading on buttons:

hx-on::before-request="this.classList.add('btn-loading')"
hx-on::after-request="this.classList.remove('btn-loading')"
Server Response Pattern

Always return UX-styled HTML fragments from your server:

// Express example
app.get('/api/users', (req, res) => {
  const users = getUsers(req.query);
  res.send(`
    <tr class="table-row">
      <td>${user.name}</td>
      <td><span class="badge color-success">Active</span></td>
    </tr>
  `);
});
Auto-Dismiss Elements

Use hx-on::load to auto-remove toasts/alerts from server responses:

<div class="toast color-success"
     hx-on::load="setTimeout(() => this.remove(), 3000)">
  Saved!
</div>