Team chat
Today
Initial server-rendered HTML
<section class="comm-frame" data-communication="chat" data-draft-scope="58f4e1b3-e32a-4861-8467-ef09d4cf8abd" data-mobile-view="detail" data-comm-focus="" hx-target="closest [data-communication]" hx-swap="outerHTML settle:0ms" hx-sync="closest [data-communication]:drop" hx-history="false">
<header class="comm-mast"><div class="comm-title"><svg class="comm-icon" aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.65" stroke-linecap="round" stroke-linejoin="round"><path d="M3 5a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H9l-5 4v-4a2 2 0 0 1-1-2z"/></svg><h1>Team chat</h1></div><span class="comm-identity">North Studio</span></header>
<div class="comm-split comm-chat-split"><aside class="comm-chat-list" aria-label="Conversations"><h2>Channels</h2><nav aria-label="Channels"><a class="comm-room-link" href="/layouts/chat?room=studio-floor" hx-get="/demo/layouts/chat?room=studio-floor" hx-push-url="/layouts/chat?room=studio-floor"><svg class="comm-icon" aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.65" stroke-linecap="round" stroke-linejoin="round"><path d="M9 3 6 21M17 3l-3 18M4 9h16M3 15h16"/></svg><span>studio-floor</span> <span class="comm-draft" data-comm-draft-for="studio-floor" hidden>Draft</span> </a><a class="comm-room-link" href="/layouts/chat?room=design-review" hx-get="/demo/layouts/chat?room=design-review" hx-push-url="/layouts/chat?room=design-review"><svg class="comm-icon" aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.65" stroke-linecap="round" stroke-linejoin="round"><path d="M9 3 6 21M17 3l-3 18M4 9h16M3 15h16"/></svg><span>design-review</span> <span class="comm-draft" data-comm-draft-for="design-review" hidden>Draft</span> </a><a class="comm-room-link" href="/layouts/chat?room=dispatch" hx-get="/demo/layouts/chat?room=dispatch" hx-push-url="/layouts/chat?room=dispatch"><svg class="comm-icon" aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.65" stroke-linecap="round" stroke-linejoin="round"><path d="M9 3 6 21M17 3l-3 18M4 9h16M3 15h16"/></svg><span>dispatch</span> <span class="comm-draft" data-comm-draft-for="dispatch" hidden>Draft</span> </a></nav>
<h2>Direct messages</h2><nav aria-label="Direct messages"><a class="comm-room-link" href="/layouts/chat?room=mara" hx-get="/demo/layouts/chat?room=mara" hx-push-url="/layouts/chat?room=mara" aria-current="true"><span aria-hidden="true" class="rl-avatar comm-avatar comm-clay comm-small">ML</span><span>Mara Lind</span> <span class="comm-draft" data-comm-draft-for="mara" hidden>Draft</span> </a><a class="comm-room-link" href="/layouts/chat?room=theo" hx-get="/demo/layouts/chat?room=theo" hx-push-url="/layouts/chat?room=theo"><span aria-hidden="true" class="rl-avatar comm-avatar comm-sand comm-small">TS</span><span>Theo Sato</span> <span class="comm-draft" data-comm-draft-for="theo" hidden>Draft</span> </a></nav></aside><section class="comm-chat" aria-label="Conversation"><div class="comm-chat-head"><a class="comm-back" href="/layouts/chat?view=channels" hx-get="/demo/layouts/chat?view=channels" hx-push-url="/layouts/chat?view=channels"><svg class="comm-icon" aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.65" stroke-linecap="round" stroke-linejoin="round"><path d="m14 6-6 6 6 6"/></svg> Conversations</a>
<div><h2 tabindex="-1" data-comm-heading>Mara Lind</h2><p>Direct conversation</p></div>
<span class="comm-members" role="img" aria-label="Participants: Mara Lind"><span aria-hidden="true" class="rl-avatar comm-avatar comm-clay comm-small">ML</span></span></div>
<div class="comm-feed" tabindex="0" aria-label="Message history"><div class="comm-date"><span>Today</span></div>
<ol><li class="comm-message"><span aria-hidden="true" class="rl-avatar comm-avatar comm-clay comm-small">ML</span><div><p class="comm-sender"><strong>Mara Lind</strong><time>09:14</time></p><p class="comm-text">Could you bring the paper swatches to Thursday’s press check?</p></div></li></ol></div><form method="post" action="/demo/layouts/chat/send" hx-post="/demo/layouts/chat/send" class="comm-chat-compose" data-rl-form data-comm-compose="mara">
<input type="hidden" name="room" value="mara"><input type="hidden" name="nonce" value="188c7d3f-1c61-46cc-95e6-92845ae2cf9a"><label class="comm-sr" for="chat-message">Message Mara Lind</label>
<textarea class="rl-textarea" id="chat-message" name="message" maxlength="1600" rows="2" placeholder="Message Mara Lind…" required></textarea>
<button type="submit" class="rl-button rl-button-primary rl-button-sm">Send <svg class="comm-icon" aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.65" stroke-linecap="round" stroke-linejoin="round"><path d="m4 5 16 7-16 7 3-7zm3 7h13"/></svg></button><div id="chat-error"><p class="comm-error" data-rl-form-error role="alert" hidden></p></div></form></section></div>
</section>HTTP exchange
Use the preview to see the request and the HTML your server returns.Use in your app
GET /demo/layouts/chat opens a channel. POST /demo/layouts/chat/send returns the updated conversation, or the composer with the submitted text and HTTP 422 on a validation error.
Serve these assets from the download’s public/ directory. Add the tags to your page head.
Page assets
<link rel="stylesheet" href="/mero.css">
<link rel="stylesheet" href="/communication-layouts.css">
<script defer src="/vendor/htmx.min.js"></script>
<script defer src="/mero.js"></script>
<script defer src="/mero-forms.js"></script>
<script defer src="/communication-layouts.js"></script>Server source · site/communication-layouts.mjs
Download full example source ↓