Message
A React component in Beamline's AI & agents category.
One turn in a conversation with an agent: the person's words in a quiet bubble, the agent's answer on the page with its orb mark, trace, tool calls and actions, or what went wrong with the way forward.
Use it for
- Chat with an agent or assistant: questions, answers, traces, tool calls.
Not for
- People talking to people (chat-thread).
- Notifications (toast, notification-center).
Anatomy
- Message (row, from user | assistant; a size container: under 20rem the agent's mark sits over its answer, and under 24rem the person's bubble and a contained answer may take 88% of the row)
- MessageAgent (orb mark) or MessageAvatar (person)
- MessageContent (bubble for the person; page for the agent, or a bubble when contained). Bubbles are flat theme surfaces with a hairline in every look (content, not panels); long unbroken text wraps inside them
- MessageActions › MessageAction (copy, retry, rate; icon buttons with tooltips)
- MessageError (icon and what went wrong, then the way forward; Retry moves under the text when the turn is narrow; role alert)
Variants
- variant: flat (default: agent on the page), contained (both in bubbles, for narrow side panels)
States
- streaming (orb thinking)
- settled
- actions on hover or focus; always on the latest answer and on touch screens
- failed (MessageError)
Keyboard
- Actions are buttons with tooltips; Tab reaches them even while hidden (they show on focus).
Motion
Actions wait for the turn's hover or focus (the shared .reveal: at once on hover, fading over --pui-motion-out; always on touch); a failure rises in; the orb breathes at rest and swirls while the agent works (paused off screen). Reduced motion keeps the fades.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
Message: from (required) | "user" | "assistant" | — | from: Role of the speaker who sent the message. Required. |
MessageContent: variant | "flat" | "contained" | — | variant: On MessageContent: Legacy appearance setting; omitted by default. Deprecated: Use appearance instead. |
MessageAgent: state / name | AgentState / string | — | state: On MessageAgent: Current state reported by the operation. Defaults to null. name: On MessageAgent: Accessible name for the avatar or agent marker; defaults to Assistant. |
MessageAvatar: name / src | string | — | name: On MessageAvatar: Accessible name for the avatar or agent marker; defaults to Assistant. src: On MessageAvatar: URL of the media to load. Defaults to no media source. |
MessageActions: always | boolean | — | always: On MessageActions: Keeps the message actions visible without hover or focus. Defaults to false. |
MessageAction: label (required) | string | — | label: On MessageAction: Visible label or accessible name for the control. Required. |
MessageError: action | ReactNode | — | action: On MessageError: Action element displayed beside the message. Defaults to no action. |
style / ref | CSSProperties / native Ref | — | style: On MessageAgent: Inline styles on the documented visual root; no inline overrides by default. ref: On MessageAvatar / MessageAgent / MessageAction: Receives the documented root element; no ref by default. |
classNames | MessageErrorClassNames; MessageAgent inherits OrbClassNames | — | On MessageAvatar / MessageAgent / MessageError / MessageAction: Classes for the named visual parts; no part overrides by default. |
appearance | "flat" | "contained" | — | On MessageContent: Flat answer text or a contained message bubble; defaults to flat. |
from (required) | "assistant" | "user" | — | Role of the speaker who sent the message. Required. |
MessageContent.variant | "flat" | "contained" | — | On MessageContent: Legacy appearance setting; omitted by default. Deprecated: Use appearance instead. |
MessageAvatar.src | string | — | On MessageAvatar: URL of the media to load. Defaults to no media source. |
MessageAvatar.name | string | — | On MessageAvatar: Accessible name for the avatar or agent marker; defaults to Assistant. |
MessageAgent.state | AgentState | — | On MessageAgent: Current state reported by the operation. Defaults to null. |
MessageAgent.name | string | — | On MessageAgent: Accessible name for the avatar or agent marker; defaults to Assistant. |
MessageAvatar.ref | Ref<HTMLSpanElement> | — | Receives the avatar root span; no ref by default. |
MessageAvatar.status | PresenceStatus | — | Optional presence indicator for the avatar; omitted by default. |
MessageAvatar.shape | "circle" | "square" | — | On MessageAvatar: circle for people, square for companies and workspaces. |
MessageAgent.ref | Ref<HTMLSpanElement> | — | On MessageAgent: Receives the documented root element; no ref by default. |
MessageAgent.style | CSSProperties | — | On MessageAgent: Inline styles on the documented visual root; no inline overrides by default. |
MessageAgent.className | string | — | On MessageAgent: Classes on the documented visual root; no override by default. |
MessageAgent.colors | [string, string] | — | On MessageAgent: Two colours for the ring (bright side, fading side). Defaults to the brand-derived --pui-orb-1/2 tokens. |
MessageAgent.colorsRef | RefObject<[string, string]> | — | On MessageAgent: Live colours without re-rendering (read each frame while reacting to volume, otherwise on change). |
MessageAgent.seed | number | — | On MessageAgent: Offsets the motion so orbs side by side never move in step. |
MessageAgent.volumeMode | "auto" | "manual" | — | On MessageAgent: "auto" reads volume from the refs or getters; "manual" takes manualInput / manualOutput (0–1). |
MessageAgent.manualInput | number | — | On MessageAgent: Fixed 0–1 microphone level used when no live input is supplied. Defaults to 0. |
MessageAgent.manualOutput | number | — | On MessageAgent: Fixed 0–1 agent audio level used when no live output is supplied. Defaults to 0. |
MessageAgent.inputVolumeRef | RefObject<number> | — | On MessageAgent: Receives the documented root element; no ref by default. |
MessageAgent.outputVolumeRef | RefObject<number> | — | On MessageAgent: Receives the documented root element; no ref by default. |
MessageAgent.getInputVolume | (() => number) | — | On MessageAgent: Returns the current 0–1 microphone level when sampled. Defaults to no live input sampler. |
MessageAgent.getOutputVolume | (() => number) | — | On MessageAgent: Returns the current 0–1 agent audio level when sampled. Defaults to no live output sampler. |
MessageAgent.resizeDebounce | number | — | On MessageAgent: Compatibility input with no effect; omitted by default. The current orb needs no resize debounce. Deprecated: kept for API compatibility with the previous WebGL orb; has no effect. |
MessageError.action | ReactNode | — | On MessageError: Action element displayed beside the message. Defaults to no action. |
MessageActions.always | boolean | — | On MessageActions: Keeps the message actions visible without hover or focus. Defaults to false. |
MessageAction.variant | ButtonVariant | — | On MessageAction: Visual weight: primary (ink-filled), secondary, outline, ghost, danger, or accent (filled with the brand). |
MessageAction.size | ButtonSize | — | On MessageAction: Height 32 / 36 / 40 px; touch 44 px for a bottom action bar on a phone. |
MessageAction.tone | ButtonTone | — | On MessageAction: Market side. On primary/accent the fill becomes --pui-up (buy) or --pui-down (sell); on the quiet variants the label takes that colour. Pair it with a word or arrow: colour is never the only signal. |
MessageAction.loading | boolean | — | On MessageAction: Shows a loader in front of the label, sets aria-busy and ignores clicks; size and focus stay. |
MessageAction.look | BuiltInLook | — | On MessageAction: Paint this button in another look than the one in force around it (DESIGN-LANGUAGE.md "Looks"). |
MessageAction.asChild | boolean | — | On MessageAction: Render the single child (a link, a Radix trigger) with the button's look instead of a <button>. |
MessageAction.iconOnly | boolean | — | On MessageAction: A square button holding only an icon (give it an aria-label). Decided by the children when left out: icon-only when no words sit anywhere among them (an icon, or a frame of icons), so `<span>Close</span>` is a label. |
MessageAction.ref | Ref<HTMLButtonElement> | — | Receives the native action button; no ref by default. |
MessageAction.label (required) | string | — | On MessageAction: Visible label or accessible name for the control. Required. |
Built from
- avatar
- button
- tooltip
- orb
Used in
Dependencies
lucide-react
Import
import { MessageContent, Message, MessageAvatar, MessageAgent, MessageError, MessageActions } from "@beamline/message";
Get it
Message is part of Beamline UI. Install the parts you need in your React app as compiled packages or editable source. Get Beamline · Connect your agent
More in AI & agents
- Image generation: The frame an AI image is generated into: a field of brand-hued pixels breathes with the progress while the model works, then the image arrives —…
- Flowchart: A workflow as steps on a dotted canvas: a trigger, conditions that branch into paths side by side, actions and waits, read top to bottom; during a run…
- Run trace: One agent run as a waterfall: every step (model calls, tools, retrieval, checks, sub-agents) nested under the step that started it, each a bar on a…
- Run theatre: One agent run as a theatre: the Run trace's waterfall under a transport (play, scrub, speed) that replays the run as it happened. Pick a step and re-run…
- Answer compare: Two answers to the same prompt side by side, and a person's verdict: A is better, a tie, B is better, or both are bad, with the reasons that decided it…
- Branch navigator: The versions of an assistant conversation that forked when a message was edited or an answer regenerated: a “‹ 2 / 3 ›” switch on each message that has…
- Response: An assistant's answer as streamed markdown in the system's reading type: bursty tokens flow in at an even pace, each new word fades in through a short…
- Chat thread: People talking to people: messages grouped by person and day, reactions, delivery and read receipts that glide to the newest message read, who is typing…
- Model picker: Choose the AI model for a request by what it can do and what it costs: a trigger with the model's name opens a searchable list grouped by provider, with…
- Task rows: Background work an agent is doing, one row per task: status as a glyph and a word, what it produced, how long it has run or took, a progress bar while…
- Conversation: The scrolling column of a conversation: follows new content while you are at the bottom, stops when you scroll up to read, and offers a way back; shared…
- Context cards: The knowledge an agent retrieved before it answered: one card per chunk with what it is about, the text it read with the search words marked, how…
- Prompt suggestions: Ready-made prompts a person can start from or follow up with: chips, cards or a list; a picked one lifts off and flies into the composer as its text…
- Plan: An agent's plan: numbered steps with live status, progress, and Approve / Edit / Reject when it needs sign-off; approving shows progress, and a refusal…
- Approval card: The agent stops and asks before it acts: what it wants to do, exactly what that changes, any choices it needs, and Approve or Reject; both run your…
- Tool call: One tool call in an agent's run: status, what it did and a short result on one quiet row that opens to the exact input and output; stops for permission…
- Recommendation card: One suggestion from the agent that the person may take or leave: what it suggests, why, the expected effect and how sure it is (a meter and a word…
- Citations: Inline numbered citations that preview their source on hover or focus, plus a numbered source list; streamed answers flow in at an even pace with the…
- Reasoning: The agent's trace, fed by your stream: a shimmering label and the seconds so far while it works, then "Thought for N seconds"; steps that check off…
- Attachment: A file tile: preview or typed glyph with the type named, name, size, upload progress, error with retry, and a keyboard-reachable remove.
- Prompt bar: The agent composer: a field that grows, @ to add a source, / for a command, a model picker, files and dictation, and one button that sends with progress…
- Selection actions: Select a passage and hand it to the agent: a bar over the selection with quick actions, your own instruction and More; while the agent works it says so…