Skip to content
omaris

Communication

Conversation

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

import { Conversation } from 'omaris'
Learn

Examples

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>

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>

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>

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>

When to use it

Use it for

  • A thread between people β€” support chat, a buyer and a seller, a team channel: ConversationBubble per message, align="end" for the person reading.
  • A live thread. New messages rise into place, the box follows them while the reader is at the end, and ConversationTyping stands in while the other side writes.
  • Delivery state on what you sent: status draws sending, sent, delivered, read and failed inside the bubble.
  • A group chat: author and avatar on every bubble β€” the name shows on the first of a run and the avatar beside the last, on their own.
  • One quoted message in a card or a review: a bubble works outside a Conversation, it just doesn't animate or sound.

Not for

  • A conversation with a model β€” streaming replies, stop, regenerate β†’ AI Chat.
  • Comments on a record, or who did what and when β†’ Timeline.
  • A list of conversations to pick from β†’ List.
  • Output that scrolls by faster than anyone reads it β†’ Log Viewer.

Do

  • Put the scroll on a parent (overflow-y-auto and a height). The conversation finds it, opens at the latest message, and follows new ones.
  • Render every message as a sibling ConversationBubble. Grouping, the author line and the avatar are read off the neighbours; a wrapper between them breaks the run.
  • Pass the same avatar snippet to every bubble of theirs and to ConversationTyping, so it steps down to whichever is last.
  • Format sentAt with latn() and a 12-hour clock before you pass it.
  • Give the thread a label, usually who it is with. It is a role="log", so a screen reader announces each message as it lands.

Don't

  • Toast a sent message. The bubble arriving is the confirmation.
  • Use variant="ghost" for short messages. Without a bubble, a run of short lines has no shape.
  • Wrap a bubble in an element of your own to put something beside it. Use avatar or actions; a wrapper breaks the run it belonged to.
  • Switch the shared sound store on for people. It is their choice and off by default; the thread's sound prop only lets it play once they have.

Quick reference

align
  • start (default)
  • end
variant
  • filled
  • tonal
  • surface
  • outline
  • ghost
tone
  • primary (default)
  • secondary
  • tertiary
  • destructive
  • success
  • warning
  • info
status
  • sending
  • sent
  • delivered
  • read
  • failed

API

Conversation

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

Consecutive messages from one side read as one turn β€” the corners between them tighten, the gap closes, and the avatar sits once, beside the last of them β€” without the caller tracking who spoke before whom. Each bubble is a ConversationBubble; ConversationTyping is the three dots while the other side writes.

What arrives after the first render arrives visibly: the bubble rises out of its own corner on a small spring, plays a cue if the sound store is on, and the thread follows it β€” when the reader was already at the latest message, or it is their own. Scrolled up to read history, they are left where they are.

It is a role="log", so a screen reader announces each new message politely, as it lands, and not the history it opened on.

import { Conversation } from 'omaris'
<div class="h-96 overflow-y-auto">  <Conversation label="Hevi Salih">    <ConversationBubble sentAt="9:12 AM">Is Thursday still on?</ConversationBubble>    <ConversationBubble align="end" status="read">It is.</ConversationBubble>  </Conversation></div>

Props

label
string

The thread's accessible name β€” usually who it is with.

follow

Defaults to true

boolean

Keep the nearest scrolling ancestor on the latest message: opened at the bottom, and following each new one while the reader is there.

sound

Defaults to true

boolean

Cue each message that arrives, when the shared sound store is on β€” a soft bell for theirs, a chirp for yours. false keeps the thread quiet even then.

class
string
children
Snippet

ConversationBubble

One message in a Conversation.

The bubble groups itself with its neighbours: a run of messages from one side tightens the corners between them and closes the gap, the author line shows only on the first of the run and the avatar only beside the last. Nothing about that is passed in β€” it is read off the siblings, so a message inserted, deleted or arriving later regroups on its own.

A tap on the bubble opens its sentAt time under it, on a short height animation; the time is in the accessibility tree either way, so a screen reader hears it without the tap. status draws the delivery ticks inside the bubble, reaction pins a pill to its corner, and actions β€” reply, react, copy β€” wait beside it until hovered or focused, and are simply there on a touchscreen.

import { ConversationBubble } from 'omaris'

Parts

Every element this renders is reachable from outside. Pass Tailwind for one part as classes={{ part: '…' }}; class covers the root and is merged last, so it always wins.

root
No description in the source yet.
avatar
Beside a run of their messages, once, at the last of them.
column
The name, the bubble and the time, stacked.
author
Who wrote it, above the first of a run β€” for a group chat.
content
The bubble itself.
status
The delivery ticks, inside the bubble at its trailing edge.
reaction
The pill pinned to the bubble's corner.
meta
The time under the bubble, folded away until the bubble is tapped.
actions
Reply, react, copy β€” beside the bubble, on its inner side.

Props

align

Defaults to 'start'

ConversationAlign

start is theirs, end is yours.

start
end
variant
ConversationBubbleVariant

Fill style. Defaults to filled for yours and surface for theirs.

filled
The accent fill β€” the default for your own messages.
tonal
The muted accent.
surface
A neutral surface β€” the default for theirs.
outline
ghost
No bubble at all: the text runs the width of the column.
tone

Defaults to 'primary'

ConversationBubbleTone
primary
secondary
tertiary
destructive
success
warning
info
author
string

Who wrote it, shown above the first of a run β€” for a group chat.

sentAt
string | Snippet

When it was sent, revealed by a tap. Format it with latn() first.

showTime bindable

Defaults to false

boolean

Whether the time is showing. Bindable; a tap flips it.

status
ConversationBubbleStatus

Delivery state of a message you sent. failed plays the error cue as it lands.

sending
sent
delivered
read
Read turns the ticks blue, except on a fill where blue would vanish.
failed
statusLabel
string

What a screen reader hears for the ticks, in place of the English word.

reaction
string | Snippet

An emoji or two pinned to the corner. A change pops it in again.

avatar
Snippet

Beside a run of their messages β€” usually an <Avatar size="sm">.

actions
Snippet

Controls beside the bubble β€” reply, react, copy.

sound

Defaults to true

boolean | SoundCue

The cue as it arrives, when the conversation and the sound store are both on. false keeps this one quiet; a cue name replaces the default.

class
string
classes
ConversationBubbleClasses

Per-part Tailwind overrides. class still covers the root.

children
Snippet

ConversationTyping

The other side is writing: three dots in a bubble of their own, on the start side.

Render it while they type and drop it when the message lands. It joins their run like any bubble of theirs β€” the corner above it tightens, and the avatar steps down beside it β€” rises in the way a message does, and the thread follows it if the reader is at the end. The dots lift in turn rather than blink; under reduced motion they sit still.

import { ConversationTyping } from 'omaris'

Parts

Every element this renders is reachable from outside. Pass Tailwind for one part as classes={{ part: '…' }}; class covers the root and is merged last, so it always wins.

root
No description in the source yet.
avatar
No description in the source yet.
bubble
No description in the source yet.
dot
No description in the source yet.

Props

label

Defaults to 'Typing'

string

What a screen reader hears. Defaults to "Typing".

avatar
Snippet

The same avatar their bubbles carry, so it steps down beside the dots.

class
string
classes
ConversationTypingClasses