Skip to main content
Hypermedia adds server-driven partial updates: fetch an HTML fragment, swap it into a target, and optionally wire reactive bindings in the result. It complements static pages the same way HTMX does, but uses Aero action functions in on:* handlers instead of hx-* attributes.
Hypermedia defaults to false. Enable it only when you need fragment swaps. HTMX remains fully supported alongside Aero hypermedia.

Prerequisites

Fragment actions need something to call. For API routes that return HTML, enable Nitro first — see Server. For busy bindings and automatic binding processing after swaps, enable both flags:
aero.config.ts

Basic fragment load

Page:
Handler (server/api/panel.get.ts):
GET, POST, PUT, PATCH, and DELETE are available in on:* handlers when hypermedia is enabled — no import needed. Call them from <script is:state> only after an explicit import:
Do not import these actions in <script is:build> — that is a compile error.

Action methods

Each function takes a URL and an optional options object (see action options and swap modes). Load a panel (GET):
Submit a form (POST — use on:submit.prevent):
When the trigger is a <form>, field name values are serialized into the request body automatically. Update or delete (PUT, PATCH, DELETE):
On <form> triggers, PUT, PATCH, and DELETE are sent as POST with a hidden _method field so servers that expect method override (common in Rails-style APIs) work without JavaScript.

Progressive enhancement by method

Action options

Second argument to every action function: GET('/api/url', { … }).

Swap target and mode

target

CSS selector for the element that receives the response. Defaults to the element that triggered the action (the button, link, or form).

swap

How response HTML is inserted relative to the target. Names match HTMX swap modes and map to insertAdjacentHTML / innerHTML behavior. Replace panel contents (innerHTML — default):
Append a row (beforeend):
Replace a list item in place (outerHTML):
Dismiss a toast (remove):

Loading state

Tie a boolean signal to request lifecycle with busy or the state action option (requires both reactivity and hypermedia):

Progressive enhancement

For static GET on <a> and POST on <form>, the compiler emits native href / action when the URL is a string literal. JavaScript enhances those elements when hypermedia is active.
On forms using POST(), add on:submit.prevent so the browser does not also submit the full document.

Next steps

Hypermedia recipes

Inline panels, partial form posts, loading UX, lifecycle hooks.

Using hypermedia with reactivity

Reactive swapped fragments, busy, and shared page state.

Reactive bindings

busy, events, and form bindings used with actions.

Server routes

Nitro handlers that return HTML fragments.