← All examples

Form + request states

Submitting posts the form fields to /demo/form. While the request is in flight, the button is disabled, an indicator is visible, and the shared loader is shown.

Sending… Working…

How it works

  1. The submit event is handled by Minu, so the browser does not navigate.
  2. minu-post serializes the form into an application/x-www-form-urlencoded body.
  3. minu-confirm asks first; cancelling sends nothing.
  4. minu-disable disables the send button; minu-indicator adds the minu-requesting class to the spinner.
  5. The server parses the POST and returns an HTML success card, swapped into #form-result.
  6. On success, error, timeout, or abort, the button and indicator are restored.
<form minu-post="/demo/form"
      minu-trigger="submit"
      minu-confirm="Send this message?"
      minu-target="#form-result"
      minu-disable="#send"
      minu-indicator="#send-spinner"
      minu-timeout="5000">
    <input name="name">
    <button type="submit" id="send">Send</button>
</form>
<span class="spinner" id="send-spinner">Sending…</span>
<div id="form-result"></div>

Files produce multipart/form-data automatically. GET forms append their fields to the query string instead of sending a body.