Skip to content
Back

Message bubble

One turn of a conversation: user bubbles, assistant prose with a model mark, copy, regenerate and thumbs, system notes, failed sends and attachments.

oxyn add message-bubble
MCP
You14:02

Why does auth.rs fail at the minute boundary?

Atlas14:02

Tokens minted at second 59 expire before verify runs. A 30 s leeway fixes it .

1.2k tokens · 4.1s
Atlas switched to claude-sonnet · context compacted
Dioxus
rsx! {
    MessageBubble {
        role: "assistant",
        text: reply,
    }
}

Rendered from Rust at build time · goes live when visible

When to use

  • After the agent answers, the user does one of five things with a message: copy it, fix what they asked (edit and resend), ask again (retry, maybe with a different model or effort), compare attempts (version arrows), or grade it (thumbs with a reason).
  • Every product we studied has this bar.
  • Agent runs add states chat kits ignore: a message interrupted mid-tool, a partial answer after a model error, a message sent mid-run that the agent has not read yet, and edits that must stop the current run before they branch.
  • This spec gives every one of those a defined look, action and label.

When not to use

Installation

Message bubble is free and MIT. The oxyn CLI copies its code, and the components it needs, into src/oxyn/ of your Dioxus or GPUI project, so it is yours to change.

Terminal
cargo install --git https://github.com/ismailqureshi72/Oxyn oxyn-cli
oxyn init
oxyn add message-bubble
Rust
use crate::oxyn::{MessageBubble, STATUS_INDICATOR_CSS};

Rather depend on the crate? cargo add oxyn-dioxus oxyn-core --git https://github.com/ismailqureshi72/Oxyn, then use oxyn_dioxus::{MessageBubble, STATUS_INDICATOR_CSS};

Usage

Dioxus · rust
rsx! {
    MessageBubble {
        role: "assistant",
        text: reply,
    }
}

Examples

Bubble

User bubble, assistant prose with actions.

You14:02

Why does auth.rs fail at the minute boundary?

Atlas14:02

Tokens minted at second 59 expire before verify runs. A 30 s leeway fixes it .

1.2k tokens · 4.1s
Atlas switched to claude-sonnet · context compacted
Code
rsx! {
    MessageBubble {
        role: "assistant",
        text: reply,
    }
}

Flat

Flat transcript (Oxyn plus).

You14:02

Why does auth.rs fail at the minute boundary?

Atlas14:02

Tokens minted at second 59 expire before verify runs. A 30 s leeway fixes it .

1.2k tokens · 4.1s
Atlas switched to claude-sonnet · context compacted
Code
rsx! {
    MessageBubble {
        role: "assistant",
        text: reply,
        variant: "flat",
    }
}

Streaming

The assistant still streaming.

You14:02

Why does auth.rs fail at the minute boundary?

Atlas14:02
Atlas switched to claude-sonnet · context compacted
Code
rsx! {
    MessageBubble {
        role: "assistant",
        text: reply,
    }
}

Failed

A failed send with Retry.

You14:02
auth.rsci-log.txt

Why does auth.rs fail at the minute boundary?

Atlas14:02

Tokens minted at second 59 expire before verify runs. A 30 s leeway fixes it .

1.2k tokens · 4.1s
Atlas switched to claude-sonnet · context compacted
Code
rsx! {
    MessageBubble {
        role: "assistant",
        text: reply,
    }
}

API reference

MessageBubble

PropTypeDefaultDescription
roleString"assistant"`user` · `assistant` · `system` · `tool`.
textrequiredString—Markdown text.
authorOption<String>Default::default()Author name.
timeOption<String>Default::default()Time label.
variantString"bubble"`bubble` · `flat`.
elapsed_msOption<u64>Default::default()Streaming (assistant): ms since start.
actionsbooltrueActions row (assistant).
failedboolDefault::default()Failed send (user).
editedboolDefault::default()Edited marker.
filesVec<String>Default::default()Attachment names.
childrenElementDefault::default()Content above the text (reasoning, tool calls).

Read from the Rust signature and doc comments.

Keyboard interactions

KeyAction
TabActions appear on focus within

Accessibility

  • Each turn is an article named by its author.
  • Actions are always reachable by keyboard; on touch they stay visible.
From the spec
  • Each message: role="article", aria-labelledby header ("You, 14:02" / "Agent, 14:02"), and aria-describedby the status row when not Complete ("Interrupted after 42 seconds").
  • Action labels: "Copy message" → "Copied" (announced politely once); "Edit message"; "Retry response"; "Retry with a different model"; "Good response" / "Bad response" (aria-pressed); "Previous version" / "Next version" and the switcher aria-label "Version 2 of 3"; "Branch from here"; "More actions".
  • Hover-revealed actions are always in the DOM / accessibility tree and appear on focus-within; they are never removed when hidden (opacity only), so keyboard users can reach them.
  • Live region: copy result, "Feedback sent", "Version 2 of 3 shown", "Response stopped", "Response failed" (assertive), "Editing message" when the editor opens.
  • Editor: labelled "Edit your message"; focus moves into it on open and back to the message's Edit button on cancel, to the new bubble on Save.
  • Contrast: user bubble text ≥ 4.5:1 on its fill in both themes; unread 60 % state dims the fill only; muted thumbs ≥ 3:1; danger rows carry words.
  • Reduced motion: §5 last row.
  • Focus order inside a message: header (if interactive) → body links / code buttons / citations → status row actions (Continue / Retry) → footer actions (copy → retry → ▾ → 👍 → 👎 → ‹ › → ⋯).

Motion & interaction

  • User bubble enter: receives the composer fly-up (≤ 260 ms, composer.md §4); for messages not typed here (sync, queue dispatch): scale 0.96 → 1 + y 6 → 0, 200 ms spring.snap (Claude desktop user bubble enters from scale .92 + 6 px, note 08 — we use a smaller scale).
  • Actions reveal: after dur.actions.reveal hover intent (80 ms) the bar fades in 120 ms; hides 160 ms after a 300 ms leave delay; focus-within keeps it visible. Last agent turn: always visible. "copy blurs into a green check", note 11 — our timings).
  • Retry: ↻ rotates 360° once (400 ms ease.in-out); keeps rotating at 1 turn / 1000 ms while Regenerating (loaders.md loop.base).
  • Thumb vote: scale 1 → 1.18 → 1 (spring.soft, ~240 ms), fill swaps to color.feedback.on; the opposite thumb dims to 50 % (still ≥ 3:1).
  • Reason row: unfolds below the bar (dur.collapse 200 ms); chips stagger in (40 ms, cap 5); on Send the row crossfades to "Thanks" then folds after 1.2 s.
  • Version switch: number rolls (dur.digit.roll 280 ms); body crossfades 180 ms while height springs
  • Edit open: bubble fill fades to the editor surface (120 ms); width locks to the bubble's width then springs to editor width (200 ms); caret at end. Cancel: reverse. Save & send: editor text morphs into the new bubble (same fly as composer send, 260 ms).
  • Interrupted / failed marker: "Interrupted" drops in from the status tab (owned by composer-status-strip.md, 220 ms ease.firm); failed row tone fades 200 ms; no shake on text.
  • Regenerating: old body to 40 % opacity (160 ms); when the new first block lands, old collapses (200 ms) with the anchor rule (messages.md §4.2).
  • Unread → Read: fill 60 → 100 % over 200 ms.
Timing
TransitionDurationDelayEasing / springStaggerFrame rate
User bubble enter (non-composer)200 ms0spring.snap—60 Hz
Actions reveal / hide120 / 160 ms80 / 300 msease.out / ease.in—60 Hz
Copy → ✓ / hold / revert160 / 1500 / 160 ms0ease.out—60 Hz
Retry spin (press / loop)400 ms / 1000 ms per turn0ease.in-out / linear—60 Hz
Thumb pop~240 ms0spring.soft—60 Hz
Reason row unfold / fold200 / 200 ms0 / 1200 ms after Thanksease.out / ease.inchips 40 ms, cap 560 Hz
Version switch180 ms crossfade + height spring; digits 280 ms0ease.in-out + spring.snap—60 Hz
Edit open / cancel120 ms fill + 200 ms width0ease.out / spring.snap—60 Hz
Save & send fly≤ 260 ms0ease.in—60 Hz
Regenerating dim / collapse160 / 200 mscollapse on first new blockease.out / spring.snap—60 Hz
Unread → Read200 ms0ease.out—30 Hz
Pending clock glyphappears after 600 ms600 msfade 120 ms——
Reduced motionall transitions → 0–80 ms opacity crossfade; no pop, no spin (↻ shows a static "…" badge while regenerating), no width spring; copy ✓ still holds 1500 ms; version digits swap without rolling—linearnoneon change

Responsive behaviour

  • User bubbles cap at 80 % width.
Edge cases (spec)
  • Long text: user messages > 24 lines fold to 12 lines with "Show more" (coss ui long-message collapse, note 01); agent long output is handled by streaming-markdown (code collapse) — prose is never folded by default.
  • Huge pastes / binary-looking text: > 20 000 chars renders as plain mono with no markdown parse (proposed).
  • Overflow: long URLs / tokens break after 40 chars in prose (text-reveal rule); code never wraps unless the code block's wrap toggle is on.
  • RTL: bubbles mirror (user on the left); grouped-corner radii mirror; ‹ › arrows mirror (‹ = previous in reading order); version numbers stay LTR in a bidi isolate; mixed-direction bubbles use the first strong character for alignment.
  • Tiny sizes (16–20 px controls): action icons 16 px with 24 px hit areas in IDE; on < 280 px width everything goes into ⋯.
  • Dense IDE panels: message/dense + message-actions/overflow; timestamps tooltip-only.
  • Touch: 44 px hit areas; long-press = actions sheet; no hover state; feedback chips wrap to two rows.
  • Slow networks: Pending clock after 600 ms; SendFailed after the adapter's timeout; feedback sends queue locally and retry silently (vote shown immediately).
  • Very fast agent: Reserved → Complete in one frame: no status row, actions fade in directly.
  • Very slow agent: footer stays hidden until Done; partial text is copyable by selection at any time.
  • Edit while the agent is mid-approval: StopConfirm copy changes to "This will cancel the pending approval and stop the run".
  • Many versions (> 9): arrows show "‹ 12 / 37 ›" with reserved width for the widest count (status-text §2.2 ReserveMagnitude).
  • Deleted / redacted message (app policy): row "Message deleted" with no actions except Undo for 5 s.
  • Feedback on an old version: stored against that version id; switching versions shows that version's vote.

Notes for AI

  • Import MessageBubble from oxyn_dioxus and include STATUS_INDICATOR_CSS plus the token stylesheet once.
  • A GPUI version exists: MessageEl in oxyn_gpui.
  • Props to set first: text.
  • It reads a clock (now) for live timers; pass one clock for the whole page rather than one per component.
  • Keep its states and timings as they ship; restyle it through the CSS variables rather than by hand.

Guides

Oxyn · 74 free components · 264 Pro components · 96 screens · 20 blocks · Dioxus and GPUI