Motivation
Using the same term for both listening (hx-trigger) and firing (htmx.trigger / HX-Trigger) creates cognitive friction:
-
hx-trigger is passive listening (e.g., "when event X happens, trigger this request").
-
htmx.trigger / HX-Trigger is active dispatching (e.g., "fire/dispatch event X now").
Proposed Alternative Names
Mental Model
-
hx-trigger="change": Listen for the change event, then issue the request.
-
htmx.dispatch(elt, "myEvent"): Dispatch myEvent on the target element.
-
HX-Dispatch: "myEvent": Instruct the client to dispatch myEvent on the <body>.
Proposal
Consider introducing HX-Dispatch / htmx.dispatch() either as:
-
Aliases alongside HX-Trigger / htmx.trigger() for better DX and backwards compatibility, or
-
A naming convention change considered for future major version roadmaps.
Motivation
Using the same term for both listening (hx-trigger) and firing (htmx.trigger / HX-Trigger) creates cognitive friction:
hx-triggeris passive listening (e.g., "when event X happens, trigger this request").htmx.trigger / HX-Triggeris active dispatching (e.g., "fire/dispatch event X now").Proposed Alternative Names
htmx.dispatch() / HX-Dispatch(matches native DOM dispatchEvent and Alpine.js)htmx.emit() / HX-Emithtmx.fire() / HX-FireMental Model
hx-trigger="change": Listen for the change event, then issue the request.htmx.dispatch(elt, "myEvent"): Dispatch myEvent on the target element.HX-Dispatch: "myEvent": Instruct the client to dispatch myEvent on the<body>.Proposal
Consider introducing
HX-Dispatch / htmx.dispatch()either as:Aliases alongside
HX-Trigger / htmx.trigger()for better DX and backwards compatibility, orA naming convention change considered for future major version roadmaps.