Summarize this week.
Chat Conversation
Keep messages, controls and a composer in one scoped conversation.
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"><article class="rl-chat-message" data-role="user"><header>You</header><div data-rl-message-text><p>Summarize this week.</p></div></article><article class="rl-chat-message" data-role="assistant"><header>Studio</header><div data-rl-message-text><div class="rl-markdown"><p>Studio shipped <strong>284 units</strong> this week against a plan of 286. Fri was the busiest day with 56 units.</p></div></div><div class="rl-chat-actions" role="group" aria-label="Message actions"><button class="rl-insight-link" type="button" data-rl-copy>Copy message</button><button class="rl-insight-link" type="button" data-rl-pressable aria-pressed="false">Helpful</button></div></article></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">
<div class="rl-chat-actions" role="group" aria-label="Suggested questions"><button class="rl-suggestion" type="button" data-rl-suggest>Summarize this week</button><button class="rl-suggestion" type="button" data-rl-suggest>Which day shipped most?</button><button class="rl-suggestion" type="button" data-rl-suggest>Show the collection mix</button></div><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.Replies come from a deterministic local shipment fixture. The endpoint returns two message articles.
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 ↓