Skip to content
Communication

Conversation

A thread of messages between people: theirs on the start side, yours on the end, in bubbles that group themselves.

Walkthrough

1. Basic

Theirs on the start side, yours on the end. A run from one side groups on its own — the corners between the bubbles tighten and the gap closes. Tap a bubble for the time it was sent.

Salam! Is the Basra delivery still on for Thursday?
9:12 AM
It is — Karwan leaves at 7. Read
9:15 AM
Twenty-four kilos, whole bean. Read
9:15 AM
Perfect. 🙏
9:16 AM
Can you add ten of the cold brew packs? The last lot sold out in two days.
9:16 AM
<script lang="ts">	import { Conversation, ConversationBubble } from 'omaris';</script>​<Conversation label="Hevi Salih" class="w-96 max-w-full">	<ConversationBubble sentAt="9:12 AM">		Salam! Is the Basra delivery still on for Thursday?	</ConversationBubble>	<ConversationBubble align="end" sentAt="9:15 AM" status="read">		It is — Karwan leaves at 7.	</ConversationBubble>	<ConversationBubble align="end" sentAt="9:15 AM" status="read">		Twenty-four kilos, whole bean.	</ConversationBubble>	<ConversationBubble sentAt="9:16 AM" reaction="🙏">Perfect.</ConversationBubble>	<ConversationBubble sentAt="9:16 AM">		Can you add ten of the cold brew packs? The last lot sold out in two days.	</ConversationBubble></Conversation>

2. Live

What arrives after the first render rises out of its corner, and the box follows it — unless you have scrolled up to read. The typing dots join their run and the avatar steps down beside them. Switch sound on to hear a chirp as yours goes and a bell as theirs lands.

Rawa Omer
Did the August invoice clear?
Went out this morning. Read
<script lang="ts">	import {		Avatar,		Button,		Conversation,		ConversationBubble,		ConversationTyping,		Switch,		sound	} from 'omaris';​	type Message = { id: number; mine: boolean; text: string; status?: 'sent' | 'read' };​	let messages = $state<Message[]>([		{ id: 1, mine: false, text: 'Did the August invoice clear?' },		{ id: 2, mine: true, text: 'Went out this morning.', status: 'read' }	]);	let typing = $state(false);	let next = 3;​	const REPLIES = ['Great, thank you!', 'Can you send the receipt too?', 'Perfect 👌'];​	function send() {		const id = next++;		messages.push({ id, mine: true, text: 'Anything else for this week?', status: 'sent' });		setTimeout(() => (typing = true), 500);		setTimeout(() => {			typing = false;			const mine = messages.find((m) => m.id === id);			if (mine) mine.status = 'read';			messages.push({ id: next++, mine: false, text: REPLIES[id % REPLIES.length] });		}, 1900);	}</script>​{#snippet avatar()}<Avatar size="sm" name="Rawa Omer" colorize />{/snippet}​<div class="flex w-96 max-w-full flex-col gap-3">	<div class="h-72 overflow-y-auto rounded-shape-lg border border-border p-4">		<Conversation label="Rawa Omer">			{#each messages as message (message.id)}				<ConversationBubble					align={message.mine ? 'end' : 'start'}					status={message.status}					avatar={message.mine ? undefined : avatar}				>					{message.text}				</ConversationBubble>			{/each}			{#if typing}<ConversationTyping {avatar} />{/if}		</Conversation>	</div>	<div class="flex flex-wrap items-center justify-between gap-3">		<Button variant="tonal" onclick={send}>Send</Button>		<Switch			label="Sound"			sound={false}			bind:checked={				() => sound.enabled,				(value) => {					sound.enabled = value;				}			}		/>	</div></div>

3. Group

A group chat: the author's name over the first bubble of each run and the avatar beside the last, both read off the neighbours rather than passed in. reaction pins a pill to the corner; actions wait beside the bubble until it is hovered, and are simply there on a touchscreen.

Dara Aziz
Dara Aziz
Standup moved to 10:30 AM
Dara Aziz
Dara Aziz
Room 2, not the kitchen.
Lana Karim
Lana Karim
I'll bring the samples from the new Ethiopian lot. 👍
On my way. Delivered
<script lang="ts">	import { Avatar, Conversation, ConversationBubble, IconButton } from 'omaris';	import Icon from '$lib/patterns/shell/icon.svelte';</script>​{#snippet dara()}<Avatar size="sm" name="Dara Aziz" colorize />{/snippet}{#snippet lana()}<Avatar size="sm" name="Lana Karim" colorize />{/snippet}{#snippet reply()}	<IconButton size="xs" aria-label="Reply">		<Icon name="reply" class="size-3.5" />	</IconButton>{/snippet}​<Conversation label="Roastery team" class="w-96 max-w-full">	<ConversationBubble author="Dara Aziz" avatar={dara} actions={reply}>		Standup moved to 10:30 AM	</ConversationBubble>	<ConversationBubble author="Dara Aziz" avatar={dara} actions={reply}>		Room 2, not the kitchen.	</ConversationBubble>	<ConversationBubble author="Lana Karim" avatar={lana} actions={reply} reaction="👍">		I'll bring the samples from the new Ethiopian lot.	</ConversationBubble>	<ConversationBubble align="end" status="delivered" actions={reply}>On my way.</ConversationBubble></Conversation>

4. Overridden

Overridden: a narrow box, a bubble with square corners and small type through classes.content, a column let out to the full width, a reaction ring matched to the box it sits on, and a time that starts open.

Square corners, small type, time already showing.
9:12 AM
The full width, and a ring that matches the box. ❤️
<script lang="ts">	import { Conversation, ConversationBubble } from 'omaris';</script>​<div class="w-64 max-w-full rounded-shape-md border border-border bg-surface-container p-2">	<Conversation label="Overrides" class="gap-1">		<ConversationBubble			showTime			sentAt="9:12 AM"			classes={{ content: 'rounded-shape-sm bg-secondary-container px-2 py-1 text-body-sm' }}		>			Square corners, small type, time already showing.		</ConversationBubble>		<ConversationBubble			align="end"			reaction="❤️"			classes={{ column: 'max-w-full', reaction: 'ring-surface-container' }}		>			The full width, and a ring that matches the box.		</ConversationBubble>	</Conversation></div>