Coming from htmx
Same idea.
Far fewer parts.
Minu covers the common htmx workflow in about 4 KB. Most pages move by renaming attributes. A few things — history, extension hooks, attribute inheritance — are deliberately absent, and saying so is the point.
The short version
Rename the prefix. Everything else works the same unless the table below says otherwise.
<!-- htmx -->
<button hx-get="/cart" hx-target="#cart" hx-swap="innerHTML">Refresh</button>
<!-- minu -->
<button minu-get="/cart" minu-target="#cart" minu-swap="innerHTML">Refresh</button>
Form posts, polling, OOB updates, and SSE map the same way:
<form hx-post="/save" hx-target="#result">
<form minu-post="/save" minu-target="#result">
<div hx-get="/price" hx-trigger="every 5s">
<div minu-get="/price" minu-trigger="every 5s">
Trigger defaults line up too: forms submit, buttons click, and form fields fire on change, so renamed markup behaves the same before you add a single trigger.
Attribute map
htmx 2.x names are shown; htmx 4 renamed a few attributes in its own upgrade guide. The Minu side is stable.
| htmx | Minu | Notes |
|---|---|---|
hx-get hx-post hx-put hx-patch hx-delete | minu-get minu-post minu-put minu-patch minu-delete | Same verbs. |
hx-target | minu-target | this is supported. |
hx-swap | minu-swap | No swap:, settle:, or transition: modifiers. |
hx-trigger | minu-trigger | One event per element. Modifiers below. |
hx-vals | minu-vals | JSON object; no js: prefix. |
hx-include | minu-include | Selector or comma-separated selectors. |
hx-headers | minu-headers | JSON object. |
hx-indicator | minu-indicator | Adds minu-requesting during the request. |
hx-disabled-elt | minu-disable | Selector, self, or this. |
hx-confirm | minu-confirm | Native confirm(). |
hx-select | minu-select | Extract before swapping. |
hx-swap-oob | minu-oob | Default is outerHTML on the selector. |
sse-connect + sse-swap | minu-sse + minu-sse-event | SSE is built in, not an extension. |
hx-boost, hx-push-url, hx-replace-url | — | No history layer. Keep server routes. |
hx-ext, hx-on | — | Use normal event listeners and browser APIs. |
hx-inherit, hx-disinherit | — | Minu never inherited, so nothing to undo. |
Triggers
The modifier grammar carries over. A comma-separated trigger list does not — put each event on its own element, or use from: to watch another element.
Defaults follow the element, like htmx: a <form> submits, a <button> clicks, and form fields fire on change. One deliberate difference: other elements — a <div>, a section — load immediately on init instead of waiting for a click.
| htmx | Minu |
|---|---|
hx-trigger="click" | minu-trigger="click" |
hx-trigger="every 5s" | minu-trigger="every 5s" |
hx-trigger="revealed" | minu-trigger="revealed" |
hx-trigger="keyup changed delay:300ms" | minu-trigger="keyup changed delay:300ms" |
hx-trigger="click from:#other" | minu-trigger="click from:#other" |
hx-trigger="click, keyup" | Not supported. Split the element. |
once, changed, delay:, throttle:, from:, load, and intersect all work. Polling pauses while the tab is hidden.
Swap modes
Minu ships the eight modes most apps use: innerHTML, outerHTML, beforebegin, afterbegin, beforeend, afterend, delete, and none.
Morphing is not in the core. It is a 0.9 KB plugin:
import minu from 'minu';
import morph from 'minu/morph';
minu.registerSwap('morph', morph);
minu.init();
Then use it like any other mode:
<div minu-get="/inbox" minu-trigger="every 10s" minu-swap="morph">
<input name="reply">
</div>
Events
Minu emits minu: events on the element and they bubble. htmx 4’s renamed htmx:phase:action events have no direct equivalent for every phase; these are the useful pairs.
| htmx | Minu |
|---|---|
htmx:beforeRequest / htmx:before:request | minu:beforeRequest (cancelable) |
htmx:afterRequest / htmx:after:request | minu:afterRequest |
htmx:afterSwap / htmx:after:swap | minu:contentLoaded |
htmx:responseError / htmx:response:error | minu:contentError |
htmx:sseMessage | minu:sseMessage |
document.addEventListener('minu:contentLoaded', (event) => {
console.log(event.detail.url);
});
What is deliberately missing
- Attribute inheritance. htmx 4 made inheritance explicit; Minu never had it. Put
minu-targetandminu-swapon the element that makes the request, or use one shared[minu-content]. - History and boost. No
hx-push-url, no snapshots, no client router. Your server keeps owning navigation. - An extension system. SSE and OOB are core. Morph is a plugin. Everything else is a normal DOM API.
- Swap modifiers. No
swap:,settle:, ortransition:. Use CSS transitions and theminu:contentLoadedevent. - JSON responses. JSON configures attributes only; responses are HTML.
Migration checklist
- Load Minu with a script tag or npm, then call
minu.init(). - Rename
hx-tominu-; move any inherited target or swap down to the requesting element. - Split comma-separated triggers; keep the modifier grammar.
- Replace event listeners with the
minu:names above. - Delete boost, history, and extension code. Add
minu/morphonly where a swap must preserve DOM state. - Run the page and check the network panel; Minu logs invalid selectors and JSON instead of failing silently.