Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

Improve ChatMessage docs page and block examples (#1866)

Kenton Quatman55226cf1531d
diff --git a/packages/cli/templates/blocks/components/ChatMessage/ChatMessageAvatarName.doc.mjs b/packages/cli/templates/blocks/components/ChatMessage/ChatMessageAvatarName.doc.mjs
new file mode 100644
index 0000000000..5978ef5da8
--- /dev/null
+++ b/packages/cli/templates/blocks/components/ChatMessage/ChatMessageAvatarName.doc.mjs
@@ -0,0 +1,9 @@
+/** @type {import('../../../../../core/src/docs-types').TemplateDoc} */
+export const doc = {
+ type: 'block',
+ name: 'ChatMessage — Avatar & Name',
+ description: 'Messages with avatars and sender names. Place the name on the bubble when using bubbles, or on the message wrapper for raw content.',
+ isReady: true,
+ aspectRatio: 4 / 3,
+ componentsUsed: ['Chat', 'ChatMessage', 'ChatMessageBubble', 'ChatMessageMetadata', 'Avatar', 'Timestamp', 'Text', 'Layout'],
+};
diff --git a/packages/cli/templates/blocks/components/ChatMessage/ChatMessageAvatarName.tsx b/packages/cli/templates/blocks/components/ChatMessage/ChatMessageAvatarName.tsx
new file mode 100644
index 0000000000..dfd2d3fe45
--- /dev/null
+++ b/packages/cli/templates/blocks/components/ChatMessage/ChatMessageAvatarName.tsx
@@ -0,0 +1,78 @@
+'use client';
+
+import {
+ XDSChatMessageList,
+ XDSChatMessage,
+ XDSChatMessageBubble,
+ XDSChatMessageMetadata,
+} from '@xds/core/Chat';
+import {XDSAvatar} from '@xds/core/Avatar';
+import {XDSTimestamp} from '@xds/core/Timestamp';
+import {XDSText} from '@xds/core/Text';
+import {XDSStack} from '@xds/core/Layout';
+
+export default function ChatMessageAvatarName() {
+ return (
+ <XDSStack direction="vertical" gap={4}>
+ <XDSText type="supporting" color="secondary">
+ Avatar and name on the bubble
+ </XDSText>
+ <XDSChatMessageList>
+ <XDSChatMessage
+ sender="assistant"
+ avatar={<XDSAvatar name="Agent" size="small" />}>
+ <XDSChatMessageBubble
+ name={
+ <XDSText type="supporting" weight="semibold" color="secondary">
+ Agent
+ </XDSText>
+ }
+ metadata={
+ <XDSChatMessageMetadata
+ timestamp={
+ <XDSTimestamp value="2026-04-28T10:15:00" format="time" />
+ }
+ />
+ }>
+ I reviewed the pull request. The changes look solid — clean code and
+ good test coverage.
+ </XDSChatMessageBubble>
+ </XDSChatMessage>
+
+ <XDSChatMessage sender="user">
+ <XDSChatMessageBubble
+ metadata={
+ <XDSChatMessageMetadata
+ timestamp={
+ <XDSTimestamp value="2026-04-28T10:16:00" format="time" />
+ }
+ status="read"
+ />
+ }>
+ Thanks! Merging it now.
+ </XDSChatMessageBubble>
+ </XDSChatMessage>
+
+ <XDSChatMessage
+ sender="assistant"
+ avatar={<XDSAvatar name="Agent" size="small" />}>
+ <XDSChatMessageBubble
+ name={
+ <XDSText type="supporting" weight="semibold" color="secondary">
+ Agent
+ </XDSText>
+ }
+ metadata={
+ <XDSChatMessageMetadata
+ timestamp={
+ <XDSTimestamp value="2026-04-28T10:17:00" format="time" />
+ }
+ />
+ }>
+ I can run the deployment pipeline once it lands. Just let me know.
+ </XDSChatMessageBubble>
+ </XDSChatMessage>
+ </XDSChatMessageList>
+ </XDSStack>
+ );
+}
diff --git a/packages/cli/templates/blocks/components/ChatMessage/ChatMessageGhost.doc.mjs b/packages/cli/templates/blocks/components/ChatMessage/ChatMessageGhost.doc.mjs
new file mode 100644
index 0000000000..ed4ff63292
--- /dev/null
+++ b/packages/cli/templates/blocks/components/ChatMessage/ChatMessageGhost.doc.mjs
@@ -0,0 +1,9 @@
+/** @type {import('../../../../../core/src/docs-types').TemplateDoc} */
+export const doc = {
+ type: 'block',
+ name: 'ChatMessage — Ghost',
+ description: 'Ghost variant for messages without visible bubble boundaries. Keeps padding for alignment but renders a transparent background, useful for AI-style responses.',
+ isReady: true,
+ aspectRatio: 4 / 3,
+ componentsUsed: ['Chat', 'ChatMessage', 'ChatMessageBubble', 'ChatMessageMetadata', 'Timestamp', 'Text', 'Layout'],
+};
diff --git a/packages/cli/templates/blocks/components/ChatMessage/ChatMessageGhost.tsx b/packages/cli/templates/blocks/components/ChatMessage/ChatMessageGhost.tsx
new file mode 100644
index 0000000000..ef6aa050e9
--- /dev/null
+++ b/packages/cli/templates/blocks/components/ChatMessage/ChatMessageGhost.tsx
@@ -0,0 +1,70 @@
+'use client';
+
+import {
+ XDSChatMessageList,
+ XDSChatMessage,
+ XDSChatMessageBubble,
+ XDSChatMessageMetadata,
+} from '@xds/core/Chat';
+import {XDSTimestamp} from '@xds/core/Timestamp';
+import {XDSText} from '@xds/core/Text';
+import {XDSStack} from '@xds/core/Layout';
+
+export default function ChatMessageGhost() {
+ return (
+ <XDSStack direction="vertical" gap={4}>
+ <XDSText type="supporting" color="secondary">
+ Ghost bubbles — no visible boundary
+ </XDSText>
+ <XDSChatMessageList>
+ <XDSChatMessage sender="assistant">
+ <XDSChatMessageBubble
+ variant="ghost"
+ metadata={
+ <XDSChatMessageMetadata
+ timestamp={
+ <XDSTimestamp value="2026-04-28T09:45:00" format="time" />
+ }
+ footer={
+ <XDSText type="supporting" color="secondary">
+ Claude Opus 4.6
+ </XDSText>
+ }
+ />
+ }>
+ Here is an analysis of your production metrics from last week.
+ Traffic peaked at 12,400 requests per second on Wednesday, with a
+ p99 latency of 45ms. Error rate stayed below 0.1% across all
+ endpoints.
+ </XDSChatMessageBubble>
+ </XDSChatMessage>
+
+ <XDSChatMessage sender="user">
+ <XDSChatMessageBubble>
+ That looks great. Can you compare it to the week before?
+ </XDSChatMessageBubble>
+ </XDSChatMessage>
+
+ <XDSChatMessage sender="assistant">
+ <XDSChatMessageBubble
+ variant="ghost"
+ metadata={
+ <XDSChatMessageMetadata
+ timestamp={
+ <XDSTimestamp value="2026-04-28T09:46:00" format="time" />
+ }
+ footer={
+ <XDSText type="supporting" color="secondary">
+ Claude Opus 4.6
+ </XDSText>
+ }
+ />
+ }>
+ Compared to the previous week, traffic is up 8% and latency improved
+ by 3ms. The deployment on Tuesday seems to have helped.
+ </XDSChatMessageBubble>
+ </XDSChatMessage>
+ </XDSChatMessageList>
+ </XDSStack>
+ );
+}
diff --git a/packages/cli/templates/blocks/components/ChatMessage/ChatMessageMultiBubble.doc.mjs b/packages/cli/templates/blocks/components/ChatMessage/ChatMessageMultiBubble.doc.mjs
new file mode 100644
index 0000000000..c041d45674
--- /dev/null
+++ b/packages/cli/templates/blocks/components/ChatMessage/ChatMessageMultiBubble.doc.mjs
@@ -0,0 +1,9 @@
+/** @type {import('../../../../../core/src/docs-types').TemplateDoc} */
+export const doc = {
+ type: 'block',
+ name: 'ChatMessage — Multi-Bubble',
+ description: 'Grouped bubbles using the group prop for corner radius reduction. Use first, middle, and last to visually connect related bubbles from the same sender.',
+ isReady: true,
+ aspectRatio: 1,
+ componentsUsed: ['Chat', 'ChatMessage', 'ChatMessageBubble', 'ChatMessageMetadata', 'Avatar', 'Timestamp', 'Text', 'Layout'],
+};
diff --git a/packages/cli/templates/blocks/components/ChatMessage/ChatMessageMultiBubble.tsx b/packages/cli/templates/blocks/components/ChatMessage/ChatMessageMultiBubble.tsx
new file mode 100644
index 0000000000..c91dbdbd49
--- /dev/null
+++ b/packages/cli/templates/blocks/components/ChatMessage/ChatMessageMultiBubble.tsx
@@ -0,0 +1,71 @@
+'use client';
+
+import {
+ XDSChatMessageList,
+ XDSChatMessage,
+ XDSChatMessageBubble,
+ XDSChatMessageMetadata,
+} from '@xds/core/Chat';
+import {XDSAvatar} from '@xds/core/Avatar';
+import {XDSTimestamp} from '@xds/core/Timestamp';
+import {XDSText} from '@xds/core/Text';
+import {XDSStack} from '@xds/core/Layout';
+
+export default function ChatMessageMultiBubble() {
+ return (
+ <XDSStack direction="vertical" gap={4}>
+ <XDSText type="supporting" color="secondary">
+ Grouped bubbles with corner radius reduction
+ </XDSText>
+ <XDSChatMessageList>
+ <XDSChatMessage sender="user">
+ <XDSChatMessageBubble group="first">
+ I have a couple of questions about the new API.
+ </XDSChatMessageBubble>
+ <XDSChatMessageBubble group="middle">
+ First, how should we handle pagination?
+ </XDSChatMessageBubble>
+ <XDSChatMessageBubble
+ group="last"
+ metadata={
+ <XDSChatMessageMetadata
+ timestamp={
+ <XDSTimestamp value="2026-04-28T11:00:00" format="time" />
+ }
+ status="delivered"
+ />
+ }>
+ And second, what's the rate limit?
+ </XDSChatMessageBubble>
+ </XDSChatMessage>
+
+ <XDSChatMessage
+ sender="assistant"
+ avatar={<XDSAvatar name="Agent" size="small" />}>
+ <XDSChatMessageBubble
+ group="first"
+ name={
+ <XDSText type="supporting" weight="semibold" color="secondary">
+ Agent
+ </XDSText>
+ }>
+ Great questions! For pagination, use cursor-based with a limit
+ parameter. The response includes a nextCursor field.
+ </XDSChatMessageBubble>
+ <XDSChatMessageBubble
+ group="last"
+ metadata={
+ <XDSChatMessageMetadata
+ timestamp={
+ <XDSTimestamp value="2026-04-28T11:01:00" format="time" />
+ }
+ />
+ }>
+ Rate limit is 100 requests per minute per API key. You'll get a 429
+ response with a Retry-After header if you exceed it.
+ </XDSChatMessageBubble>
+ </XDSChatMessage>
+ </XDSChatMessageList>
+ </XDSStack>
+ );
+}
diff --git a/packages/cli/templates/blocks/components/ChatMessage/ChatMessageShowcase.doc.mjs b/packages/cli/templates/blocks/components/ChatMessage/ChatMessageShowcase.doc.mjs
index cfbf35fee7..b80a474aff 100644
--- a/packages/cli/templates/blocks/components/ChatMessage/ChatMessageShowcase.doc.mjs
+++ b/packages/cli/templates/blocks/components/ChatMessage/ChatMessageShowcase.doc.mjs
@@ -2,9 +2,9 @@
export const doc = {
type: 'block',
name: 'ChatMessage',
- description: 'Chat messages demonstrating full prop variance: avatar, name, timestamp, metadata with action buttons, multi-bubble groups, delivery status, ghost variant (without visible bubbles), and system messages.',
+ description: 'A user multi-bubble group with delivery status and an assistant ghost response with avatar, name, timestamp, and model info.',
isReady: true,
isShowcase: true,
aspectRatio: 4 / 3,
- componentsUsed: ['Chat', 'ChatMessage', 'ChatMessageBubble', 'ChatMessageMetadata', 'ChatSystemMessage', 'Avatar', 'Timestamp', 'Button', 'Icon', 'Text', 'Layout'],
+ componentsUsed: ['Chat', 'ChatMessage', 'ChatMessageBubble', 'ChatMessageMetadata', 'Avatar', 'Timestamp', 'Text', 'Layout'],
};
diff --git a/packages/cli/templates/blocks/components/ChatMessage/ChatMessageShowcase.tsx b/packages/cli/templates/blocks/components/ChatMessage/ChatMessageShowcase.tsx
index 16903a55fd..e25ee43a31 100644
--- a/packages/cli/templates/blocks/components/ChatMessage/ChatMessageShowcase.tsx
+++ b/packages/cli/templates/blocks/components/ChatMessage/ChatMessageShowcase.tsx
@@ -5,120 +5,67 @@ import {
XDSChatMessage,
XDSChatMessageBubble,
XDSChatMessageMetadata,
- XDSChatSystemMessage,
} from '@xds/core/Chat';
import {XDSAvatar} from '@xds/core/Avatar';
-import {XDSText} from '@xds/core/Text';
import {XDSTimestamp} from '@xds/core/Timestamp';
-import {XDSButton} from '@xds/core/Button';
-import {XDSIcon} from '@xds/core/Icon';
-import {XDSHStack, XDSVStack} from '@xds/core/Layout';
+import {XDSText} from '@xds/core/Text';
+import {XDSStack} from '@xds/core/Layout';
+import * as stylex from '@stylexjs/stylex';
+
+const styles = stylex.create({
+ root: {
+ maxWidth: 600,
+ },
+});
export default function ChatMessageShowcase() {
return (
- <XDSVStack gap={4}>
- <XDSText type="supporting" color="secondary">
- With message bubbles
- </XDSText>
+ <XDSStack direction="vertical" gap={4} xstyle={styles.root}>
<XDSChatMessageList>
- <XDSChatSystemMessage variant="divider">
- Today
- </XDSChatSystemMessage>
-
<XDSChatMessage sender="user">
- <XDSChatMessageBubble
- metadata={
- <XDSChatMessageMetadata
- timestamp={<XDSTimestamp value="2026-03-15T14:30:00" format="time" />}
- status="read"
- />
- }>
- Can you review my pull request?
- </XDSChatMessageBubble>
- </XDSChatMessage>
-
- {/* Full props: avatar, name, bubble, multi-bubble group, metadata with actions */}
- <XDSChatMessage
- sender="assistant"
- avatar={<XDSAvatar name="Navi" size="small" />}>
- <XDSChatMessageBubble
- group="first"
- name={
- <XDSText type="supporting" weight="semibold" color="secondary">
- Navi
- </XDSText>
- }>
- Sure! I took a look at PR #1742.
+ <XDSChatMessageBubble group="first">
+ I just pushed the refactored auth module.
</XDSChatMessageBubble>
<XDSChatMessageBubble
group="last"
metadata={
<XDSChatMessageMetadata
- timestamp={<XDSTimestamp value="2026-03-15T14:31:00" format="time" />}
- footer={
- <XDSHStack gap={1}>
- <XDSButton
- label="Copy"
- variant="ghost"
- size="sm"
- icon={<XDSIcon icon="copy" size="sm" />}
- isIconOnly
- onClick={() => {}}
- />
- <XDSText type="supporting" color="secondary">
- Claude Opus 4.6
- </XDSText>
- </XDSHStack>
+ timestamp={
+ <XDSTimestamp value="2026-04-28T14:30:00" format="time" />
}
+ status="read"
/>
}>
- The changes look great — clean code, good test coverage. Ship it!
- </XDSChatMessageBubble>
- </XDSChatMessage>
-
- <XDSChatMessage sender="user">
- <XDSChatMessageBubble
- metadata={
- <XDSChatMessageMetadata
- timestamp={<XDSTimestamp value="2026-03-15T14:32:00" format="time" />}
- status="delivered"
- />
- }>
- Thanks, shipping now!
+ Can you review the token validation changes?
</XDSChatMessageBubble>
</XDSChatMessage>
- </XDSChatMessageList>
- <XDSText type="supporting" color="secondary">
- Without message bubbles (ghost variant)
- </XDSText>
- <XDSChatMessageList>
<XDSChatMessage
sender="assistant"
- avatar={<XDSAvatar name="Navi" size="small" />}
+ avatar={<XDSAvatar name="Agent" size="small" />}
name={
<XDSText type="supporting" weight="semibold" color="secondary">
- Navi
+ Agent
</XDSText>
}
metadata={
<XDSChatMessageMetadata
- timestamp={<XDSTimestamp value="2026-03-15T14:31:00" format="time" />}
- footer={<XDSText type="supporting" color="secondary">Claude Opus 4.6</XDSText>}
+ timestamp={
+ <XDSTimestamp value="2026-04-28T14:31:00" format="time" />
+ }
+ footer={
+ <XDSText type="supporting" color="secondary">
+ Claude Opus 4.6
+ </XDSText>
+ }
/>
}>
<XDSChatMessageBubble variant="ghost">
- Here is a response without a visible bubble boundary. The ghost
- variant keeps padding for alignment but renders transparent.
- </XDSChatMessageBubble>
- </XDSChatMessage>
-
- <XDSChatMessage sender="user">
- <XDSChatMessageBubble variant="ghost">
- User messages can also use the ghost variant for a minimal look.
+ Looks good — the refresh token rotation is solid and the error
+ handling covers all the edge cases. Ship it.
</XDSChatMessageBubble>
</XDSChatMessage>
</XDSChatMessageList>
- </XDSVStack>
+ </XDSStack>
);
}
diff --git a/packages/core/src/Chat/Chat.doc.mjs b/packages/core/src/Chat/Chat.doc.mjs
index 7511e8bb73..0f7532d33d 100644
--- a/packages/core/src/Chat/Chat.doc.mjs
+++ b/packages/core/src/Chat/Chat.doc.mjs
@@ -66,11 +66,11 @@ export const docs = {
},
{
name: 'XDSChatMessageMetadata',
- description: 'Composable metadata row that sits below a chat bubble. Arranges timestamp, footer actions, and delivery status in a single line — direction auto-reverses for user messages. Pass it to the metadata prop on XDSChatMessageBubble. Renders nothing when all slots are empty.',
+ description: 'Composable metadata row for chat messages. Renders timestamp, footer content, and delivery status in a single row. Direction reverses for user sender. Renders nothing if all props are empty.',
props: [
- {name: 'timestamp', type: 'ReactNode', description: 'Timestamp content — typically an XDSTimestamp component with format="time" or format="relative".'},
- {name: 'footer', type: 'ReactNode', description: 'Footer actions or info — copy/retry/feedback buttons, model label, or any ReactNode. Use XDSHStack with ghost icon-only buttons for action rows.'},
- {name: 'status', type: "'sending' | 'sent' | 'delivered' | 'read' | 'error'", description: 'Delivery status indicator. Renders an icon and label — pulse animation for sending, red for error.'},
+ {name: 'timestamp', type: 'ReactNode', description: 'Timestamp content — a string or XDSTimestamp component.'},
+ {name: 'footer', type: 'ReactNode', description: 'Footer content — model info, reaction buttons, copy button.'},
+ {name: 'status', type: "'sending' | 'sent' | 'delivered' | 'read' | 'error'", description: 'Message delivery status. Shows icon + label.'},
],
},
{
@@ -176,26 +176,20 @@ export const docs = {
{ guidance: true, description: 'Use XDSChatLayout for full-page chat — it handles auto-scroll, density adaptation, and composer docking automatically.' },
{ guidance: true, description: 'Use XDSChatSystemMessage with variant="divider" for date separators and default for status notices like joins, leaves, or topic changes.' },
{ guidance: true, description: 'Add an icon to system messages when the type is not obvious from the text alone — membership changes, encryption notices, or AI activity benefit from visual reinforcement.' },
- { guidance: true, description: 'Pass XDSChatMessageMetadata to the bubble\'s metadata prop. It auto-reverses direction for user vs. assistant messages so timestamps and status always read naturally.' },
- { guidance: true, description: 'Use XDSTimestamp with format="time" for recent messages and format="relative" for older ones. Avoid raw date strings — XDSTimestamp handles localization and live updates.' },
- { guidance: true, description: 'Keep footer actions in XDSChatMessageMetadata small and icon-only — ghost variant, size="sm" buttons grouped in an XDSHStack. Reserve footer actions for assistant messages.' },
+ { guidance: true, description: 'Use the group prop on bubbles (first, middle, last) when a single sender sends multiple consecutive messages — it tightens corner radius to visually connect them.' },
+ { guidance: true, description: 'Use the ghost bubble variant for AI-style responses that need alignment without a visual boundary.' },
{ guidance: false, description: 'Don\'t build custom input containers or composer chrome — XDSChatComposer handles the border radius, shadows, focus ring, and slot layout. Customise through slots, not wrapping.' },
{ guidance: false, description: 'Don\'t place metadata or names on both the bubble and the message wrapper — pick one based on whether the content has a bubble boundary.' },
{ guidance: false, description: 'Don\'t use the status prop for transient success messages — it\'s for errors and warnings that need the user\'s attention before they send another message.' },
{ guidance: false, description: 'Don\'t use XDSChatSystemMessage for sender content — it has no avatar, alignment, or bubble. Use XDSChatMessage with a sender role instead.' },
{ guidance: false, description: 'Don\'t put long or multi-line content in a system message — keep it to a single short sentence. If you need more, use a bubble or a card.' },
- { guidance: false, description: 'Don\'t add footer actions to user messages — users don\'t need to copy, retry, or rate their own messages. Use status alone for delivery feedback.' },
- { guidance: false, description: 'Don\'t show delivery status on assistant messages — status (sending, delivered, read) only applies to outbound user messages.' },
+ { guidance: false, description: 'Don\'t nest XDSChatMessage inside another XDSChatMessage — each message is a standalone article element with its own sender context.' },
],
anatomy: [
- { name: 'Drawer', required: false, description: 'Collapsible area above the input for file tokens, context chips, or other attachments. Use XDSChatComposerDrawer.' },
- { name: 'Header actions', required: false, description: 'Left-aligned icon buttons above the input — attach file, mention, etc. Use icon-only size="sm" buttons.' },
- { name: 'Header context', required: false, description: 'Right-aligned contextual info — context window progress bar, model info, supporting text.' },
- { name: 'Input', required: true, description: 'The text input area. Uses a built-in textarea by default, or replace with XDSChatComposerInput for trigger menus and tokens.' },
- { name: 'Footer actions', required: false, description: 'Left-aligned buttons below the input — model selector, settings, etc.' },
- { name: 'Send actions', required: false, description: 'Actions to the left of the send button — microphone, voice input, etc.' },
- { name: 'Send button', required: false, description: 'Circular send/stop toggle. Built-in by default; toggles between send and stop based on isStreaming.' },
- { name: 'Status', required: false, description: 'Error or warning message rendered above or below the composer.' },
+ { name: 'Avatar', required: false, description: 'A sender avatar rendered beside the message. Typically XDSAvatar with size="small". Hidden for system messages.' },
+ { name: 'Name', required: false, description: 'Sender name above the message body. Place on the bubble when using bubbles, or on the message wrapper for raw content.' },
+ { name: 'Content', required: true, description: 'The message body — one or more XDSChatMessageBubble elements, or any free-form ReactNode like images or tool calls.' },
+ { name: 'Metadata', required: false, description: 'Timestamp, delivery status, and footer actions below the message. Place on the last bubble or on the message wrapper.' },
],
},
};
@@ -237,16 +231,14 @@ export const docsZh = {
{ guidance: true, description: 'Use XDSChatLayout for full-page chat — it handles auto-scroll, density adaptation, and composer docking automatically.' },
{ guidance: true, description: 'Use XDSChatSystemMessage with variant="divider" for date separators and default for status notices like joins, leaves, or topic changes.' },
{ guidance: true, description: 'Add an icon to system messages when the type is not obvious from the text alone — membership changes, encryption notices, or AI activity benefit from visual reinforcement.' },
- { guidance: true, description: 'Pass XDSChatMessageMetadata to the bubble\'s metadata prop. It auto-reverses direction for user vs. assistant messages so timestamps and status always read naturally.' },
- { guidance: true, description: 'Use XDSTimestamp with format="time" for recent messages and format="relative" for older ones. Avoid raw date strings — XDSTimestamp handles localization and live updates.' },
- { guidance: true, description: 'Keep footer actions in XDSChatMessageMetadata small and icon-only — ghost variant, size="sm" buttons grouped in an XDSHStack. Reserve footer actions for assistant messages.' },
+ { guidance: true, description: 'Use the group prop on bubbles (first, middle, last) when a single sender sends multiple consecutive messages — it tightens corner radius to visually connect them.' },
+ { guidance: true, description: 'Use the ghost bubble variant for AI-style responses that need alignment without a visual boundary.' },
{ guidance: false, description: 'Don\'t build custom input containers or composer chrome — XDSChatComposer handles the border radius, shadows, focus ring, and slot layout. Customise through slots, not wrapping.' },
{ guidance: false, description: 'Don\'t place metadata or names on both the bubble and the message wrapper — pick one based on whether the content has a bubble boundary.' },
{ guidance: false, description: 'Don\'t use the status prop for transient success messages — it\'s for errors and warnings that need the user\'s attention before they send another message.' },
{ guidance: false, description: 'Don\'t use XDSChatSystemMessage for sender content — it has no avatar, alignment, or bubble. Use XDSChatMessage with a sender role instead.' },
{ guidance: false, description: 'Don\'t put long or multi-line content in a system message — keep it to a single short sentence. If you need more, use a bubble or a card.' },
- { guidance: false, description: 'Don\'t add footer actions to user messages — users don\'t need to copy, retry, or rate their own messages. Use status alone for delivery feedback.' },
- { guidance: false, description: 'Don\'t show delivery status on assistant messages — status (sending, delivered, read) only applies to outbound user messages.' },
+ { guidance: false, description: 'Don\'t nest XDSChatMessage inside another XDSChatMessage — each message is a standalone article element with its own sender context.' },
],
},
components: [
@@ -285,8 +277,8 @@ export const docsZh = {
},
{
name: 'XDSChatMessageMetadata',
- description: '可组合的消息元数据行。渲染时间戳、页脚操作和发送状态。用户消息方向自动反转。传递给气泡的 metadata 属性。',
- propDescriptions: {timestamp: '时间戳内容 — 通常是 XDSTimestamp 组件,使用 format="time" 或 format="relative"。', footer: '页脚操作或信息 — 复制/重试/反馈按钮、模型标签。使用 XDSHStack 组合 ghost 图标按钮。', status: '发送状态指示器。渲染图标和标签 — sending 有脉冲动画,error 为红色。'},
+ description: '可组合的消息元数据行。渲染时间戳、页脚内容和发送状态。用户消息方向反转。',
+ propDescriptions: {timestamp: '时间戳内容 — 字符串或 XDSTimestamp 组件。', footer: '页脚内容 — 模型信息、反应按钮、复制按钮。', status: '消息发送状态。显示图标和标签。'},
},
{
name: 'XDSChatSystemMessage',
@@ -406,16 +398,14 @@ export const docsDense = {
{ guidance: true, description: 'Name/metadata on bubble if bubble boundary, on message wrapper if raw content.' },
{ guidance: true, description: 'XDSChatLayout for full-page — auto-scroll, density adaptation, composer docking.' },
{ guidance: true, description: 'SystemMessage: divider variant for date breaks, default for status notices. Add icon for membership/encryption/AI messages.' },
- { guidance: true, description: 'XDSChatMessageMetadata on bubble metadata prop — auto-reverses for user vs assistant.' },
- { guidance: true, description: 'XDSTimestamp format="time" for recent, format="relative" for older. No raw date strings.' },
- { guidance: true, description: 'Footer actions: ghost size="sm" icon-only buttons in XDSHStack. Assistant messages only.' },
+ { guidance: true, description: 'Group prop on bubbles (first/middle/last) for consecutive same-sender messages — tightens corner radius.' },
+ { guidance: true, description: 'Ghost bubble variant for AI-style responses without a visual boundary.' },
{ guidance: false, description: 'Custom composer chrome — Composer handles radius, shadows, focus ring. Use slots.' },
{ guidance: false, description: 'Metadata/names on both bubble and wrapper — pick one.' },
{ guidance: false, description: 'Status for success toasts — it\'s for errors/warnings before next send.' },
{ guidance: false, description: 'SystemMessage for sender content — no avatar/alignment/bubble. Use ChatMessage instead.' },
{ guidance: false, description: 'Long/multi-line system messages — keep to a single short sentence.' },
- { guidance: false, description: 'Footer actions on user messages — use status alone for delivery feedback.' },
- { guidance: false, description: 'Delivery status on assistant messages — status is for outbound user messages only.' },
+ { guidance: false, description: 'Nesting XDSChatMessage inside another — each is a standalone article.' },
],
},
components: [
@@ -454,11 +444,11 @@ export const docsDense = {
},
{
name: 'XDSChatMessageMetadata',
- description: 'composable metadata row; timestamp · footer · status; auto-reverses for user sender; pass to bubble metadata prop',
+ description: 'composable metadata row; renders timestamp · footer · status; reverses for user sender',
propDescriptions: {
- timestamp: 'XDSTimestamp w/ format="time" or "relative"',
- footer: 'actions/info: ghost sm icon-only buttons in XDSHStack, model label',
- status: 'delivery status; icon+label; pulse for sending, red for error',
+ timestamp: 'timestamp content; string or XDSTimestamp',
+ footer: 'footer content; model info, reaction btns, copy btn',
+ status: 'delivery status; shows icon+label',
},
},
{