← All examples

Basic auto-load

The element fetches widget.html on page load. Minu injects the response into its inner minu-content target and hides the loader when the request finishes.

Loading widget…

How it works

  1. minu.init() finds the element because it has minu-get.
  2. minu-trigger="load" fires the request immediately.
  3. There is no minu-target, so Minu picks the inner [minu-content] element.
  4. The server returns an HTML fragment; Minu sanitizes it and sets innerHTML.
  5. The shared [minu-loader] is shown during flight and hidden afterward.
<div minu-get="widget.html" minu-trigger="load">
    <div class="loader" minu-loader>Loading…</div>
    <div minu-content></div>
</div>

<script src="/dist/minu.min.js"></script>
<script>minu.init();</script>

Target resolution order

OrderTarget
1minu-target="selector"
2First [minu-content] inside the trigger element
3The single [minu-content] on the page
4The trigger element itself