Team chat
Today
Initial server-rendered HTML
<section class="comm-frame" data-communication="chat" data-draft-scope="bb8f055e-dc62-4545-afa2-a10a519b05c5" 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" aria-current="true"><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"><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><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>studio-floor</h2><p>Daily work from the studio</p></div>
<span class="comm-members" role="img" aria-label="Participants: Mara Lind, Julian Park, Iris Chen"><span aria-hidden="true" class="rl-avatar comm-avatar comm-clay comm-small">ML</span><span aria-hidden="true" class="rl-avatar comm-avatar comm-moss comm-small">JP</span><span aria-hidden="true" class="rl-avatar comm-avatar comm-sky comm-small">IC</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:32</time></p><p class="comm-text">The Field Notes proofs are on the big table. Here’s the cover photograph for reference.</p><a class="comm-attachment" href="/studio-lamp.webp" download="field-notes-cover.webp" aria-label="Download Field Notes cover photograph">
<img src="/studio-lamp.webp" alt="" width="72" height="52"><span><strong>Cover photograph</strong><small>WebP · 13 KB</small></span><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="M12 3v12m-5-5 5 5 5-5M4 16v4h16v-4"/></svg></a></div></li><li class="comm-message"><span aria-hidden="true" class="rl-avatar comm-avatar comm-moss comm-small">JP</span><div><p class="comm-sender"><strong>Julian Park</strong><time>09:35</time></p><p class="comm-text">I put the oak and graphite samples beside them, so we can check all three together.</p></div></li><li class="comm-message"><span aria-hidden="true" class="rl-avatar comm-avatar comm-sky comm-small">IC</span><div><p class="comm-sender"><strong>Iris Chen</strong><time>09:41</time></p><p class="comm-text">I’ll take a look before the press check. Thanks for laying those out!</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="studio-floor">
<input type="hidden" name="room" value="studio-floor"><input type="hidden" name="nonce" value="3db99f7f-1c2c-49c7-9696-584d01bde615"><label class="comm-sr" for="chat-message">Message #studio-floor</label>
<textarea class="rl-textarea" id="chat-message" name="message" maxlength="1600" rows="2" placeholder="Message #studio-floor…" 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 ↓