Form
Submit native fields to the server and render an HTML response in place.
HTML
<div class="rl-scope" data-rl-scope>
<form class="rl-stack" action="/demo/catalog/form" method="get"
hx-get="/demo/catalog/form" hx-target="#catalog-form-result" hx-swap="innerHTML">
<div class="rl-field">
<label class="rl-label" for="demo-form-name">Name</label>
<input class="rl-input" id="demo-form-name" name="name" autocomplete="given-name" required maxlength="80" placeholder="Taylor">
</div>
<button class="rl-button rl-button-primary" type="submit">Send to server</button>
<div class="rl-form-status" id="catalog-form-result" role="status"></div>
</form>
</div>HTTP exchange
Use the preview to see the request and the HTML your server returns.This demo uses a read-only GET. Use POST for changes and keep validation on the server.
Use in your app
Copy these tags into your page head once. Serve the files at the paths shown, then add the example’s template to your page.
Page assets
<link rel="stylesheet" href="/mero.css">
<script defer src="/vendor/htmx.min.js"></script>
<script defer src="/mero.js"></script>Point the HTMX attributes at your own HTML endpoints. Use the live preview’s HTTP exchange to inspect the request and response.
Download library and examples ↓