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-bubbleWhy does auth.rs fail at the minute boundary?
Tokens minted at second 59 expire before verify runs. A 30 s leeway fixes it .
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
- The empty state of an AI app: use Starter prompts instead.
- Markdown that renders correctly while it streams: use Streaming markdown instead.
- The thinking of a reply: use Reasoning block instead.
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.
cargo install --git https://github.com/ismailqureshi72/Oxyn oxyn-cli
oxyn init
oxyn add message-bubbleuse 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
rsx! {
MessageBubble {
role: "assistant",
text: reply,
}
}Examples
Bubble
User bubble, assistant prose with actions.
Why does auth.rs fail at the minute boundary?
Tokens minted at second 59 expire before verify runs. A 30 s leeway fixes it .
Code
rsx! {
MessageBubble {
role: "assistant",
text: reply,
}
}Flat
Flat transcript (Oxyn plus).
Why does auth.rs fail at the minute boundary?
Tokens minted at second 59 expire before verify runs. A 30 s leeway fixes it .
Code
rsx! {
MessageBubble {
role: "assistant",
text: reply,
variant: "flat",
}
}Streaming
The assistant still streaming.
Why does auth.rs fail at the minute boundary?
Code
rsx! {
MessageBubble {
role: "assistant",
text: reply,
}
}Failed
A failed send with Retry.
Why does auth.rs fail at the minute boundary?
Tokens minted at second 59 expire before verify runs. A 30 s leeway fixes it .
Code
rsx! {
MessageBubble {
role: "assistant",
text: reply,
}
}API reference
MessageBubble
| Prop | Type | Default | Description |
|---|---|---|---|
role | String | "assistant" | `user` · `assistant` · `system` · `tool`. |
textrequired | String | — | Markdown text. |
author | Option<String> | Default::default() | Author name. |
time | Option<String> | Default::default() | Time label. |
variant | String | "bubble" | `bubble` · `flat`. |
elapsed_ms | Option<u64> | Default::default() | Streaming (assistant): ms since start. |
actions | bool | true | Actions row (assistant). |
failed | bool | Default::default() | Failed send (user). |
edited | bool | Default::default() | Edited marker. |
files | Vec<String> | Default::default() | Attachment names. |
children | Element | Default::default() | Content above the text (reasoning, tool calls). |
Read from the Rust signature and doc comments.
Keyboard interactions
| Key | Action |
|---|---|
| Tab | Actions 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-labelledbyheader ("You, 14:02" / "Agent, 14:02"), andaria-describedbythe status row when notComplete("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 switcheraria-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.revealhover 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 whileRegenerating(loaders.mdloop.base). - Thumb vote: scale 1 → 1.18 → 1 (
spring.soft, ~240 ms), fill swaps tocolor.feedback.on; the opposite thumb dims to 50 % (still ≥ 3:1). - Reason row: unfolds below the bar (
dur.collapse200 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.roll280 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
| Transition | Duration | Delay | Easing / spring | Stagger | Frame rate |
|---|---|---|---|---|---|
| User bubble enter (non-composer) | 200 ms | 0 | spring.snap | — | 60 Hz |
| Actions reveal / hide | 120 / 160 ms | 80 / 300 ms | ease.out / ease.in | — | 60 Hz |
| Copy → ✓ / hold / revert | 160 / 1500 / 160 ms | 0 | ease.out | — | 60 Hz |
| Retry spin (press / loop) | 400 ms / 1000 ms per turn | 0 | ease.in-out / linear | — | 60 Hz |
| Thumb pop | ~240 ms | 0 | spring.soft | — | 60 Hz |
| Reason row unfold / fold | 200 / 200 ms | 0 / 1200 ms after Thanks | ease.out / ease.in | chips 40 ms, cap 5 | 60 Hz |
| Version switch | 180 ms crossfade + height spring; digits 280 ms | 0 | ease.in-out + spring.snap | — | 60 Hz |
| Edit open / cancel | 120 ms fill + 200 ms width | 0 | ease.out / spring.snap | — | 60 Hz |
| Save & send fly | ≤ 260 ms | 0 | ease.in | — | 60 Hz |
| Regenerating dim / collapse | 160 / 200 ms | collapse on first new block | ease.out / spring.snap | — | 60 Hz |
| Unread → Read | 200 ms | 0 | ease.out | — | 30 Hz |
| Pending clock glyph | appears after 600 ms | 600 ms | fade 120 ms | — | — |
| Reduced motion | all 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 | — | linear | none | on 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:
Pendingclock after 600 ms;SendFailedafter 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:
StopConfirmcopy 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
MessageBubblefromoxyn_dioxusand includeSTATUS_INDICATOR_CSSplus the token stylesheet once. - A GPUI version exists:
MessageElinoxyn_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.