The htmx team announced the release of htmx 4.0.0 on 2026-08-28, presenting the update as a major architectural revision that changes the library's internal transport model and event system while aiming to keep most application-level behavior close to the 2.x line.

According to the project's release announcement, development of htmx 4 took roughly eight months and grew out of work with newer browser primitives, especially the Fetch API and asynchronous programming patterns. Earlier versions of htmx had stayed on XMLHttpRequest largely for backward-compatibility reasons. The move to fetch is one of the clearest technical markers of the new release, even if the maintainers expect it to remain mostly transparent for end users.

The team also highlighted a more visible breaking change around attribute inheritance. In htmx 2, many attributes were inherited by default, allowing behavior defined on parent elements to flow into children. The maintainers said that model was powerful but often hard to reason about. In htmx 4, inheritance is no longer automatic; developers now need to mark inherited behavior explicitly. The project described this as the biggest likely migration burden and said it is shipping a command-line upgrade checker to find places where developers need to add the new inherited marker or update legacy event names.

Events were the other major redesign. The announcement said htmx 2's events had accumulated organically over time and were difficult to understand as a coherent system. In htmx 4, the project standardizes events around a clearer naming pattern, `htmx:phase:action[:sub-action]`, and provides tooling to identify older event references embedded in attributes or JavaScript.

History handling also changes. Instead of restoring page snapshots from localStorage, htmx 4 will re-fetch the page on back navigation and swap it into the document or a designated history element. The maintainers argued that this avoids a class of bugs caused when third-party JavaScript mutated a cached DOM snapshot without preserving the runtime logic that originally produced those changes. For developers who still want client-side storage, the team is shipping a separate history-cache extension built around sessionStorage.

Two additional features received special emphasis in the release announcement, including built-in support for morphing swaps. Even without the full details in the supplied excerpt, the broader picture is clear: htmx 4 is being positioned as a long-horizon update intended to keep htmx applications viable as "100-year web services," in the maintainers' phrase, while modernizing internals and smoothing interaction with other scripting approaches.

The project is also handling rollout cautiously. The team said version 4.0 would not immediately become the default "latest" release on npm, because maintainers do not want to force upgrades on users who rely on unversioned CDN URLs. Instead, the 2.x line will remain the default for now, while 4.0 stays on the next track until some point in early 2027. On 2026-08-28, then, the release was both a launch and a staged transition plan: a major new branch intended to be adopted deliberately rather than silently absorbed. That makes the release notable both for what changed in the code and for how deliberately the maintainers are trying to manage the migration window.