Prompt Input
Collect a question and submit it to a server-rendered response endpoint.
HTML
<section class="rl-chat" aria-label="Dispatch assistant demo">
<header class="rl-chat-head"><strong>Dispatch assistant</strong><span>Local demo</span></header>
<div class="rl-chat-history" role="log" aria-label="Conversation" aria-relevant="additions"></div>
<form class="rl-chat-compose" data-rl-compose method="post" action="/demo/insights/reply" hx-post="/demo/insights/reply" hx-target="previous .rl-chat-history" hx-swap="beforeend" hx-sync="this:drop">
<label><span class="rl-insight-sr">Your question</span><textarea class="rl-input" name="message" placeholder="Ask about this week’s dispatches…" rows="2" required maxlength="1000"></textarea></label>
<div class="rl-chat-compose-foot"><span data-rl-chat-status role="status"></span><button type="submit" class="rl-button rl-button-primary rl-button-sm">Send <span aria-hidden="true">↑</span></button></div>
</form>
</section>HTTP exchange
Use the preview to see the request and the HTML your server returns.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">
<link rel="stylesheet" href="/mero-insights.css">
<script defer src="/vendor/htmx.min.js"></script>
<script defer src="/mero.js"></script>
<script defer src="/mero-insights.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 ↓