Chat bubbles — a user message and the assistant's reply, each in its own bubble to keep the exchange readable.
Loading demo: ai-message-bubble-real-world
npx sdaia-ui@latest add ai-message-bubble
import { AiMessageBubble } from "sdaia-ui"1<AiMessageBubble state="user">2Can you summarize Saudi Vision 2030 for me?3</AiMessageBubble>45<AiMessageBubble state="ai" variant="brand">6Saudi Vision 2030 is a strategic framework to diversify the economy…7</AiMessageBubble>89<AiMessageBubble state="streaming">{partialReply}</AiMessageBubble>1011<AiMessageBubble state="error" onRetry={regenerate} />
A user turn and the assistant reply, alternating to build a scannable transcript.
Loading demo: ai-message-bubble-default
The user message — a right-aligned brand bubble with no avatar.
Loading demo: ai-message-bubble-user
The assistant reply — a left-aligned bubble with the sparkle avatar.
Loading demo: ai-message-bubble-ai
A reply arriving live, with a pulsing caret at the end of the text.
Loading demo: ai-message-bubble-streaming
A failed message — a danger-tinted bubble with a Retry action.
Loading demo: ai-message-bubble-error
Brand style — a high-emphasis, brand-coloured assistant bubble.
Loading demo: ai-message-bubble-brand
Outline style — a bordered, transparent assistant bubble.
Loading demo: ai-message-bubble-outline
Right-to-left layout — the bubble flips side and the tail corner follows the sender.
Loading demo: ai-message-bubble-rtl
Prop | Type | Default | Required |
|---|---|---|---|
state | 'user' | 'ai' | 'streaming' | 'error' | 'ai' | optional |
variant | 'neutral' | 'brand' | 'outline' | 'neutral' | optional |
dir | 'ltr' | 'rtl' | 'ltr' | optional |
children | ReactNode | — | optional |
maxWidth | number | string | 520 | optional |
avatar | ReactNode | — | optional |
avatarIcon | string | sparklesStroke | optional |
showAvatar | boolean | true | optional |
retryLabel | ReactNode | 'Retry' | optional |
onRetry | (e) => void | — | optional |
showRetry | boolean | true | optional |
retryIcon | string | refreshStroke | optional |