Skip to content

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

TypeScript

refactor: rename XDSChatComposerAttachments → XDSChatComposerDrawer (#1714)

Kenton Quatmanf31e21dcbc58
diff --git a/apps/storybook/stories/ChatComposer.stories.tsx b/apps/storybook/stories/ChatComposer.stories.tsx
index ac21660a7b..8a7160e709 100644
--- a/apps/storybook/stories/ChatComposer.stories.tsx
+++ b/apps/storybook/stories/ChatComposer.stories.tsx
@@ -1,7 +1,7 @@
import type {Meta, StoryObj} from '@storybook/react';
import {
XDSChatComposer,
- XDSChatComposerAttachments,
+ XDSChatComposerDrawer,
XDSChatComposerInput,
XDSChatSendButton,
} from '@xds/core/Chat';
@@ -135,11 +135,11 @@ export const WithAttachments: Story = {
render: () => (
<XDSChatComposer
onSubmit={value => console.log('Submit:', value)}
- attachments={
- <XDSChatComposerAttachments>
+ drawer={
+ <XDSChatComposerDrawer>
<XDSToken label="report.pdf" onRemove={() => {}} />
<XDSToken label="data.csv" onRemove={() => {}} />
- </XDSChatComposerAttachments>
+ </XDSChatComposerDrawer>
}
headerActions={
<XDSButton
@@ -173,10 +173,10 @@ export const FullFeatured: Story = {
isStreaming={isStreaming}
onStop={() => setIsStreaming(false)}
placeholder="Ask me anything..."
- attachments={
- <XDSChatComposerAttachments>
+ drawer={
+ <XDSChatComposerDrawer>
<XDSToken label="design-spec.pdf" onRemove={() => {}} />
- </XDSChatComposerAttachments>
+ </XDSChatComposerDrawer>
}
headerActions={
<>
@@ -241,15 +241,15 @@ export const WithManyAttachments: Story = {
render: () => (
<XDSChatComposer
onSubmit={value => console.log('Submit:', value)}
- attachments={
- <XDSChatComposerAttachments count={6}>
+ drawer={
+ <XDSChatComposerDrawer count={6}>
<XDSToken label="new_feature_prd.docx" onRemove={() => {}} />
<XDSToken label="2026_roadmap.docx" onRemove={() => {}} />
<XDSToken label="user_flow.pdf" onRemove={() => {}} />
<XDSToken label="launch_plan.docx" onRemove={() => {}} />
<XDSToken label="user_feedback.csv" onRemove={() => {}} />
<XDSToken label="kpis.csv" onRemove={() => {}} />
- </XDSChatComposerAttachments>
+ </XDSChatComposerDrawer>
}
/>
),
diff --git a/apps/storybook/stories/ChatLayout.stories.tsx b/apps/storybook/stories/ChatLayout.stories.tsx
index dd186062c6..0f944357da 100644
--- a/apps/storybook/stories/ChatLayout.stories.tsx
+++ b/apps/storybook/stories/ChatLayout.stories.tsx
@@ -7,7 +7,7 @@ import {
XDSChatMessageMetadata,
XDSChatSystemMessage,
XDSChatComposer,
- XDSChatComposerAttachments,
+ XDSChatComposerDrawer,
XDSChatComposerInput,
XDSChatTokenizedText,
XDSChatToolCalls,
@@ -15,7 +15,6 @@ import {
type XDSChatComposerToken,
type XDSChatComposerTrigger,
type XDSChatToolCallItem,
-
} from '@xds/core/Chat';
import {XDSMarkdown} from '@xds/core/Markdown';
import {XDSToken} from '@xds/core/Token';
@@ -176,7 +175,12 @@ const SEED_MESSAGES: Message[] = [
},
],
},
- {id: 4, role: 'user', text: 'Nice, can you also check the Card component?', sentAt: new Date('2026-03-15T14:35:00')},
+ {
+ id: 4,
+ role: 'user',
+ text: 'Nice, can you also check the Card component?',
+ sentAt: new Date('2026-03-15T14:35:00'),
+ },
];
// =============================================================================
@@ -228,7 +232,13 @@ export const FullAIChat: StoryObj = {
setMessages(prev => [
...prev,
- {id: msgId, role: 'assistant', text: '', introText, isStreaming: true},
+ {
+ id: msgId,
+ role: 'assistant',
+ text: '',
+ introText,
+ isStreaming: true,
+ },
]);
let i = 0;
@@ -402,9 +412,9 @@ export const FullAIChat: StoryObj = {
onSubmit={handleSubmit}
onStop={handleStop}
isStreaming={isStreaming}
- attachments={
+ drawer={
files.length > 0 ? (
- <XDSChatComposerAttachments>
+ <XDSChatComposerDrawer>
{files.map(f => (
<XDSToken
key={f}
@@ -412,7 +422,7 @@ export const FullAIChat: StoryObj = {
onRemove={() => setFiles(prev => prev.filter(x => x !== f))}
/>
))}
- </XDSChatComposerAttachments>
+ </XDSChatComposerDrawer>
) : undefined
}
headerActions={
@@ -492,17 +502,20 @@ export const FullAIChat: StoryObj = {
return (
<XDSChatMessage key={msg.id} sender="user">
{msg.files && (
- <XDSChatComposerAttachments>
+ <XDSChatComposerDrawer>
{msg.files.map(f => (
<XDSToken key={f} label={f} />
))}
- </XDSChatComposerAttachments>
+ </XDSChatComposerDrawer>
)}
<XDSChatMessageBubble
metadata={
<XDSChatMessageMetadata
timestamp={
- <XDSTimestamp value={msg.sentAt ?? new Date(msg.id)} format="time" />
+ <XDSTimestamp
+ value={msg.sentAt ?? new Date(msg.id)}
+ format="time"
+ />
}
status={msg.isSending ? 'sending' : undefined}
/>
@@ -514,13 +527,19 @@ export const FullAIChat: StoryObj = {
</XDSChatMessage>
);
}
- {/* Assistant: intro text → tool calls → rest of text */}
+ {
+ /* Assistant: intro text → tool calls → rest of text */
+ }
const introEnd = msg.introText?.length ?? 0;
const hasToolCalls = msg.toolCalls && msg.toolCalls.length > 0;
- const introContent = introEnd > 0 ? msg.text.slice(0, introEnd) : null;
- const restContent = introEnd > 0 && msg.text.length > introEnd
- ? msg.text.slice(introEnd).replace(/^\n+/, '')
- : !introEnd ? msg.text : null;
+ const introContent =
+ introEnd > 0 ? msg.text.slice(0, introEnd) : null;
+ const restContent =
+ introEnd > 0 && msg.text.length > introEnd
+ ? msg.text.slice(introEnd).replace(/^\n+/, '')
+ : !introEnd
+ ? msg.text
+ : null;
return (
<XDSChatMessage key={msg.id} sender="assistant">
{introContent && (
@@ -534,28 +553,42 @@ export const FullAIChat: StoryObj = {
)}
{!msg.isStreaming && msg.text && (
<XDSChatMessageMetadata
- timestamp={<XDSTimestamp value={new Date(msg.id)} format="time" />}
+ timestamp={
+ <XDSTimestamp value={new Date(msg.id)} format="time" />
+ }
footer={
<>
<span>Claude Opus 4.6</span>
<span>·</span>
<XDSButton
label="Thumbs up"
- icon={<HandThumbUpIcon style={{width: 14, height: 14}} />}
+ icon={
+ <HandThumbUpIcon
+ style={{width: 14, height: 14}}
+ />
+ }
variant="ghost"
size="sm"
isIconOnly
/>
<XDSButton
label="Thumbs down"
- icon={<HandThumbDownIcon style={{width: 14, height: 14}} />}
+ icon={
+ <HandThumbDownIcon
+ style={{width: 14, height: 14}}
+ />
+ }
variant="ghost"
size="sm"
isIconOnly
/>
<XDSButton
label="Copy"
- icon={<ClipboardDocumentIcon style={{width: 14, height: 14}} />}
+ icon={
+ <ClipboardDocumentIcon
+ style={{width: 14, height: 14}}
+ />
+ }
variant="ghost"
size="sm"
isIconOnly
@@ -681,9 +714,9 @@ export const PanelView: StoryObj = {
onSubmit={handleSubmit}
onStop={handleStop}
isStreaming={isStreaming}
- attachments={
+ drawer={
files.length > 0 ? (
- <XDSChatComposerAttachments>
+ <XDSChatComposerDrawer>
{files.map(f => (
<XDSToken
key={f}
@@ -691,7 +724,7 @@ export const PanelView: StoryObj = {
onRemove={() => setFiles(prev => prev.filter(x => x !== f))}
/>
))}
- </XDSChatComposerAttachments>
+ </XDSChatComposerDrawer>
) : undefined
}
headerActions={
@@ -752,11 +785,11 @@ export const PanelView: StoryObj = {
return (
<XDSChatMessage key={msg.id} sender="user">
{msg.files && (
- <XDSChatComposerAttachments>
+ <XDSChatComposerDrawer>
{msg.files.map(f => (
<XDSToken key={f} label={f} />
))}
- </XDSChatComposerAttachments>
+ </XDSChatComposerDrawer>
)}
<XDSChatMessageBubble>
<XDSChatTokenizedText tokens={mentionTokens}>
diff --git a/packages/cli/src/codemods/transforms/v0.0.13/__tests__/rename-attachments-to-drawer.test.mjs b/packages/cli/src/codemods/transforms/v0.0.13/__tests__/rename-attachments-to-drawer.test.mjs
new file mode 100644
index 0000000000..55a0c1497b
--- /dev/null
+++ b/packages/cli/src/codemods/transforms/v0.0.13/__tests__/rename-attachments-to-drawer.test.mjs
@@ -0,0 +1,124 @@
+import {describe, it, expect} from 'vitest';
+
+async function applyTransform(source) {
+ const {default: transform} = await import(
+ '../rename-attachments-to-drawer.mjs'
+ );
+ const jscodeshift = (await import('jscodeshift')).default;
+ const j = jscodeshift.withParser('tsx');
+ const api = {jscodeshift: j, stats: () => {}, report: () => {}};
+ const file = {source, path: 'test.tsx'};
+ const result = transform(file, api);
+ return result ?? source;
+}
+
+describe('rename-attachments-to-drawer', () => {
+ it('renames import specifier', async () => {
+ const input = `import { XDSChatComposerAttachments } from '@xds/core/Chat';`;
+ const output = await applyTransform(input);
+ expect(output).toContain('XDSChatComposerDrawer');
+ expect(output).not.toContain('XDSChatComposerAttachments');
+ });
+
+ it('renames type import', async () => {
+ const input = `import type { XDSChatComposerAttachmentsProps } from '@xds/core/Chat';`;
+ const output = await applyTransform(input);
+ expect(output).toContain('XDSChatComposerDrawerProps');
+ expect(output).not.toContain('XDSChatComposerAttachmentsProps');
+ });
+
+ it('renames JSX element (self-closing)', async () => {
+ const input = `import { XDSChatComposerAttachments } from '@xds/core/Chat';
+const x = <XDSChatComposerAttachments count={3} />;`;
+ const output = await applyTransform(input);
+ expect(output).toContain('<XDSChatComposerDrawer');
+ expect(output).not.toContain('<XDSChatComposerAttachments');
+ });
+
+ it('renames JSX element (with children)', async () => {
+ const input = `import { XDSChatComposerAttachments } from '@xds/core/Chat';
+const x = <XDSChatComposerAttachments><span>child</span></XDSChatComposerAttachments>;`;
+ const output = await applyTransform(input);
+ expect(output).toContain('<XDSChatComposerDrawer>');
+ expect(output).toContain('</XDSChatComposerDrawer>');
+ expect(output).not.toContain('XDSChatComposerAttachments');
+ });
+
+ it('renames attachments prop to drawer on XDSChatComposer', async () => {
+ const input = `<XDSChatComposer onSubmit={fn} attachments={<Foo />} />`;
+ const output = await applyTransform(input);
+ expect(output).toContain('drawer={');
+ expect(output).not.toContain('attachments={');
+ });
+
+ it('does not rename attachments prop on other components', async () => {
+ const input = `<SomeOtherComponent attachments={items} />`;
+ const output = await applyTransform(input);
+ expect(output).toContain('attachments={');
+ });
+
+ it('renames CSS class in string literals', async () => {
+ const input = `const cls = "xds-chat-composer-attachments";`;
+ const output = await applyTransform(input);
+ expect(output).toContain('xds-chat-composer-drawer');
+ expect(output).not.toContain('xds-chat-composer-attachments');
+ });
+
+ it('renames CSS class in template literals', async () => {
+ const input = 'const cls = `xds-chat-composer-attachments`;';
+ const output = await applyTransform(input);
+ expect(output).toContain('xds-chat-composer-drawer');
+ expect(output).not.toContain('xds-chat-composer-attachments');
+ });
+
+ it('renames type reference in annotation', async () => {
+ const input = `import type { XDSChatComposerAttachmentsProps } from '@xds/core/Chat';
+const props: XDSChatComposerAttachmentsProps = {};`;
+ const output = await applyTransform(input);
+ expect(output).toContain('XDSChatComposerDrawerProps');
+ expect(output).not.toContain('XDSChatComposerAttachmentsProps');
+ });
+
+ it('handles combined import + JSX + prop rename', async () => {
+ const input = `import { XDSChatComposer, XDSChatComposerAttachments } from '@xds/core/Chat';
+export default function App() {
+ return (
+ <XDSChatComposer
+ onSubmit={fn}
+ attachments={
+ <XDSChatComposerAttachments count={2}>
+ <Token label="file.pdf" />
+ </XDSChatComposerAttachments>
+ }
+ />
+ );
+}`;
+ const output = await applyTransform(input);
+ expect(output).toContain('XDSChatComposerDrawer');
+ expect(output).toContain('drawer={');
+ expect(output).toContain('<XDSChatComposerDrawer');
+ expect(output).toContain('</XDSChatComposerDrawer>');
+ expect(output).not.toContain('XDSChatComposerAttachments');
+ expect(output).not.toContain('attachments={');
+ });
+
+ it('returns undefined when no changes needed', async () => {
+ const {default: transform} = await import(
+ '../rename-attachments-to-drawer.mjs'
+ );
+ const jscodeshift = (await import('jscodeshift')).default;
+ const j = jscodeshift.withParser('tsx');
+ const api = {jscodeshift: j, stats: () => {}, report: () => {}};
+ const source = `<XDSChatComposer drawer={<XDSChatComposerDrawer />} />`;
+ const result = transform({source, path: 'test.tsx'}, api);
+ expect(result).toBeUndefined();
+ });
+
+ it('preserves aliased imports', async () => {
+ const input = `import { XDSChatComposerAttachments as Attachments } from '@xds/core/Chat';
+const x = <Attachments count={3} />;`;
+ const output = await applyTransform(input);
+ expect(output).toContain('XDSChatComposerDrawer as Attachments');
+ expect(output).toContain('<Attachments');
+ });
+});
diff --git a/packages/cli/src/codemods/transforms/v0.0.13/index.mjs b/packages/cli/src/codemods/transforms/v0.0.13/index.mjs
index 15fd2ef543..16fb0bbdf9 100644
--- a/packages/cli/src/codemods/transforms/v0.0.13/index.mjs
+++ b/packages/cli/src/codemods/transforms/v0.0.13/index.mjs
@@ -12,6 +12,10 @@ import iconNameDeprecations, {
meta as iconNameDeprecationsMeta,
} from './icon-name-deprecations.mjs';
+import renameAttachmentsToDrawer, {
+ meta as renameAttachmentsToDrawerMeta,
+} from './rename-attachments-to-drawer.mjs';
+
export default [
{
name: 'toolbar-density-to-size',
@@ -23,4 +27,9 @@ export default [
transform: iconNameDeprecations,
meta: iconNameDeprecationsMeta,
},
+ {
+ name: 'rename-attachments-to-drawer',
+ transform: renameAttachmentsToDrawer,
+ meta: renameAttachmentsToDrawerMeta,
+ },
];
diff --git a/packages/cli/src/codemods/transforms/v0.0.13/rename-attachments-to-drawer.mjs b/packages/cli/src/codemods/transforms/v0.0.13/rename-attachments-to-drawer.mjs
new file mode 100644
index 0000000000..722baf0044
--- /dev/null
+++ b/packages/cli/src/codemods/transforms/v0.0.13/rename-attachments-to-drawer.mjs
@@ -0,0 +1,164 @@
+/**
+ * @file Codemod: Rename XDSChatComposerAttachments → XDSChatComposerDrawer
+ *
+ * Transforms:
+ * - Import: XDSChatComposerAttachments → XDSChatComposerDrawer
+ * - Import: XDSChatComposerAttachmentsProps → XDSChatComposerDrawerProps
+ * - JSX: <XDSChatComposerAttachments → <XDSChatComposerDrawer
+ * - JSX: </XDSChatComposerAttachments> → </XDSChatComposerDrawer>
+ * - Prop: attachments={...} → drawer={...} on XDSChatComposer
+ * - Type refs: XDSChatComposerAttachmentsProps → XDSChatComposerDrawerProps
+ * - CSS class: xds-chat-composer-attachments → xds-chat-composer-drawer (in strings)
+ */
+
+export const meta = {
+ title: 'Rename XDSChatComposerAttachments to XDSChatComposerDrawer',
+ description:
+ 'Renames `XDSChatComposerAttachments` component and type to `XDSChatComposerDrawer`, ' +
+ 'renames the `attachments` prop to `drawer` on `XDSChatComposer`, and updates ' +
+ 'CSS class references from `xds-chat-composer-attachments` to `xds-chat-composer-drawer`.',
+ pr: '#1714',
+};
+
+const IMPORT_RENAMES = {
+ XDSChatComposerAttachments: 'XDSChatComposerDrawer',
+ XDSChatComposerAttachmentsProps: 'XDSChatComposerDrawerProps',
+};
+
+const CSS_CLASS_RENAMES = {
+ 'xds-chat-composer-attachments': 'xds-chat-composer-drawer',
+};
+
+export default function transformer(file, api) {
+ const j = api.jscodeshift;
+ const root = j(file.source);
+ let hasChanges = false;
+
+ // Track local names (handles aliased imports)
+ const localToComponent = new Map();
+
+ // --- 1. Rename imports ---
+ root.find(j.ImportSpecifier).forEach((path) => {
+ const importedName = path.node.imported.name;
+ const newName = IMPORT_RENAMES[importedName];
+ if (!newName) return;
+
+ const localName = path.node.local.name;
+
+ if (localName === importedName) {
+ // import { XDSChatComposerAttachments } → import { XDSChatComposerDrawer }
+ path.node.imported = j.identifier(newName);
+ path.node.local = j.identifier(newName);
+ localToComponent.set(newName, newName);
+ } else {
+ // import { XDSChatComposerAttachments as Foo } → import { XDSChatComposerDrawer as Foo }
+ path.node.imported = j.identifier(newName);
+ localToComponent.set(localName, newName);
+ }
+ hasChanges = true;
+ });
+
+ // --- 2. Rename JSX elements (opening + closing tags) ---
+ for (const [oldName, newName] of Object.entries(IMPORT_RENAMES)) {
+ if (oldName.endsWith('Props')) continue; // Skip type-only renames for JSX
+
+ root
+ .find(j.JSXIdentifier, {name: oldName})
+ .forEach((path) => {
+ const parent = path.parent.node;
+ if (
+ parent.type === 'JSXOpeningElement' ||
+ parent.type === 'JSXClosingElement'
+ ) {
+ path.node.name = newName;
+ hasChanges = true;
+ }
+ });
+ }
+
+ // --- 3. Rename `attachments` prop → `drawer` on XDSChatComposer ---
+ root.find(j.JSXOpeningElement).forEach((path) => {
+ const name = path.node.name;
+ const componentName = name.type === 'JSXIdentifier' ? name.name : null;
+ if (componentName !== 'XDSChatComposer') return;
+
+ const attrs = path.node.attributes;
+ for (const attr of attrs) {
+ if (
+ attr.type === 'JSXAttribute' &&
+ attr.name?.name === 'attachments'
+ ) {
+ attr.name = j.jsxIdentifier('drawer');
+ hasChanges = true;
+ }
+ }
+ });
+
+ // --- 4. Rename type references ---
+ root.find(j.TSTypeReference).forEach((path) => {
+ const typeName = path.node.typeName;
+ if (typeName.type === 'Identifier') {
+ const newName = IMPORT_RENAMES[typeName.name];
+ if (newName) {
+ typeName.name = newName;
+ hasChanges = true;
+ }
+ }
+ });
+
+ // Also handle plain Identifier references (e.g. typeof, React.ComponentProps<typeof X>)
+ root.find(j.Identifier, {name: 'XDSChatComposerAttachments'}).forEach((path) => {
+ const parent = path.parent.node;
+ if (
+ parent.type === 'ImportSpecifier' ||
+ parent.type === 'JSXOpeningElement' ||
+ parent.type === 'JSXClosingElement'
+ ) {
+ return;
+ }
+ path.node.name = 'XDSChatComposerDrawer';
+ hasChanges = true;
+ });
+
+ root.find(j.Identifier, {name: 'XDSChatComposerAttachmentsProps'}).forEach((path) => {
+ const parent = path.parent.node;
+ if (parent.type === 'ImportSpecifier') return;
+ path.node.name = 'XDSChatComposerDrawerProps';
+ hasChanges = true;
+ });
+
+ // --- 5. Rename CSS class strings ---
+ root.find(j.StringLiteral).forEach((path) => {
+ for (const [oldClass, newClass] of Object.entries(CSS_CLASS_RENAMES)) {
+ if (path.node.value.includes(oldClass)) {
+ path.node.value = path.node.value.replace(
+ new RegExp(oldClass.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), 'g'),
+ newClass,
+ );
+ hasChanges = true;
+ }
+ }
+ });
+
+ // Also check template literals
+ root.find(j.TemplateLiteral).forEach((path) => {
+ for (const quasi of path.node.quasis) {
+ for (const [oldClass, newClass] of Object.entries(CSS_CLASS_RENAMES)) {
+ if (quasi.value.raw.includes(oldClass)) {
+ quasi.value.raw = quasi.value.raw.replace(
+ new RegExp(oldClass.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), 'g'),
+ newClass,
+ );
+ quasi.value.cooked = quasi.value.cooked.replace(
+ new RegExp(oldClass.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), 'g'),
+ newClass,
+ );
+ hasChanges = true;
+ }
+ }
+ }
+ });
+
+ if (!hasChanges) return undefined;
+ return root.toSource({quote: 'single'});
+}
diff --git a/packages/cli/templates/blocks/components/Chat/ChatComposerAttachments.tsx b/packages/cli/templates/blocks/components/Chat/ChatComposerAttachments.tsx
index 523886e553..0c33c14252 100644
--- a/packages/cli/templates/blocks/components/Chat/ChatComposerAttachments.tsx
+++ b/packages/cli/templates/blocks/components/Chat/ChatComposerAttachments.tsx
@@ -1,9 +1,6 @@
'use client';
-import {
- XDSChatComposer,
- XDSChatComposerAttachments,
-} from '@xds/core/Chat';
+import {XDSChatComposer, XDSChatComposerDrawer} from '@xds/core/Chat';
import {XDSToken} from '@xds/core/Token';
import {XDSProgressBar} from '@xds/core/ProgressBar';
import {XDSStack} from '@xds/core/Layout';
@@ -18,11 +15,11 @@ export default function ChatComposerAttachments() {
</XDSText>
<XDSChatComposer
onSubmit={() => {}}
- attachments={
- <XDSChatComposerAttachments>
+ drawer={
+ <XDSChatComposerDrawer>
<XDSToken label="report.pdf" onRemove={() => {}} />
<XDSToken label="data.csv" onRemove={() => {}} />
- </XDSChatComposerAttachments>
+ </XDSChatComposerDrawer>
}
headerContext={
<XDSProgressBar label="Context window" value={3} isLabelHidden />
@@ -35,15 +32,15 @@ export default function ChatComposerAttachments() {
</XDSText>
<XDSChatComposer
onSubmit={() => {}}
- attachments={
- <XDSChatComposerAttachments count={6}>
+ drawer={
+ <XDSChatComposerDrawer count={6}>
<XDSToken label="new_feature_prd.docx" onRemove={() => {}} />
<XDSToken label="2026_roadmap.docx" onRemove={() => {}} />
<XDSToken label="user_flow.pdf" onRemove={() => {}} />
<XDSToken label="launch_plan.docx" onRemove={() => {}} />
<XDSToken label="user_feedback.csv" onRemove={() => {}} />
<XDSToken label="kpis.csv" onRemove={() => {}} />
- </XDSChatComposerAttachments>
+ </XDSChatComposerDrawer>
}
/>
</XDSStack>
diff --git a/packages/cli/templates/blocks/components/ChatComposer/ChatComposerComposerWithAttachments.tsx b/packages/cli/templates/blocks/components/ChatComposer/ChatComposerComposerWithAttachments.tsx
index d40471bab1..11c59325a9 100644
--- a/packages/cli/templates/blocks/components/ChatComposer/ChatComposerComposerWithAttachments.tsx
+++ b/packages/cli/templates/blocks/components/ChatComposer/ChatComposerComposerWithAttachments.tsx
@@ -1,9 +1,6 @@
'use client';
-import {
- XDSChatComposer,
- XDSChatComposerAttachments,
-} from '@xds/core/Chat';
+import {XDSChatComposer, XDSChatComposerDrawer} from '@xds/core/Chat';
import {XDSToken} from '@xds/core/Token';
import {XDSProgressBar} from '@xds/core/ProgressBar';
@@ -11,11 +8,11 @@ export default function ChatComposerComposerWithAttachments() {
return (
<XDSChatComposer
onSubmit={() => {}}
- attachments={
- <XDSChatComposerAttachments>
+ drawer={
+ <XDSChatComposerDrawer>
<XDSToken label="report.pdf" onRemove={() => {}} />
<XDSToken label="data.csv" onRemove={() => {}} />
- </XDSChatComposerAttachments>
+ </XDSChatComposerDrawer>
}
headerContext={
<XDSProgressBar label="Context window" value={3} isLabelHidden />
diff --git a/packages/cli/templates/blocks/components/ChatComposer/ChatComposerFullFeaturedComposer.tsx b/packages/cli/templates/blocks/components/ChatComposer/ChatComposerFullFeaturedComposer.tsx
index 19dbd183f6..e9618e1de6 100644
--- a/packages/cli/templates/blocks/components/ChatComposer/ChatComposerFullFeaturedComposer.tsx
+++ b/packages/cli/templates/blocks/components/ChatComposer/ChatComposerFullFeaturedComposer.tsx
@@ -1,9 +1,6 @@
'use client';
-import {
- XDSChatComposer,
- XDSChatComposerAttachments,
-} from '@xds/core/Chat';
+import {XDSChatComposer, XDSChatComposerDrawer} from '@xds/core/Chat';
import {XDSToken} from '@xds/core/Token';
import {XDSButton} from '@xds/core/Button';
import {XDSProgressBar} from '@xds/core/ProgressBar';
@@ -13,10 +10,10 @@ export default function ChatComposerFullFeaturedComposer() {
<XDSChatComposer
onSubmit={() => {}}
placeholder="Ask me anything..."
- attachments={
- <XDSChatComposerAttachments>
+ drawer={
+ <XDSChatComposerDrawer>
<XDSToken label="design-spec.pdf" onRemove={() => {}} />
- </XDSChatComposerAttachments>
+ </XDSChatComposerDrawer>
}
headerContext={
<XDSProgressBar label="Context window" value={3} isLabelHidden />
diff --git a/packages/cli/templates/pages/ai-chat/page.tsx b/packages/cli/templates/pages/ai-chat/page.tsx
index ae4bfe0286..f2fb74489a 100644
--- a/packages/cli/templates/pages/ai-chat/page.tsx
+++ b/packages/cli/templates/pages/ai-chat/page.tsx
@@ -15,7 +15,7 @@ import {XDSVStack, XDSHStack} from '@xds/core/Layout';
import {XDSText, XDSHeading} from '@xds/core/Text';
import {
XDSChatComposer,
- XDSChatComposerAttachments,
+ XDSChatComposerDrawer,
XDSChatComposerInput,
XDSChatDictationButton,
XDSChatLayout,
@@ -469,9 +469,9 @@ export default function AIChatTemplate() {
style={{minHeight: '44px'}}
/>
}
- attachments={
+ drawer={
attachments.length > 0 ? (
- <XDSChatComposerAttachments count={attachments.length}>
+ <XDSChatComposerDrawer count={attachments.length}>
{attachments.map((name, i) => (
<XDSToken
key={i}
@@ -483,7 +483,7 @@ export default function AIChatTemplate() {
}
/>
))}
- </XDSChatComposerAttachments>
+ </XDSChatComposerDrawer>
) : undefined
}
headerActions={
@@ -722,9 +722,9 @@ export default function AIChatTemplate() {
style={{minHeight: '44px'}}
/>
}
- attachments={
+ drawer={
attachments.length > 0 ? (
- <XDSChatComposerAttachments
+ <XDSChatComposerDrawer
count={attachments.length}
defaultIsCollapsed>
{attachments.map((name, i) => (
@@ -736,7 +736,7 @@ export default function AIChatTemplate() {
}
/>
))}
- </XDSChatComposerAttachments>
+ </XDSChatComposerDrawer>
) : undefined
}
headerActions={
diff --git a/packages/core/src/Chat/Chat.doc.mjs b/packages/core/src/Chat/Chat.doc.mjs
index 0fa954b4d8..be69f471d4 100644
--- a/packages/core/src/Chat/Chat.doc.mjs
+++ b/packages/core/src/Chat/Chat.doc.mjs
@@ -9,7 +9,7 @@ export const docs = {
{className: 'xds-chat-layout', visualProps: ['density']},
{className: 'xds-chat-composer', visualProps: ['density']},
{className: 'xds-chat-composer-input'},
- {className: 'xds-chat-composer-attachments', visualProps: ['collapsed']},
+ {className: 'xds-chat-composer-drawer', visualProps: ['collapsed']},
{className: 'xds-chat-message', visualProps: ['sender']},
{className: 'xds-chat-message-bubble', visualProps: ['sender', 'variant']},
{className: 'xds-chat-message-list', visualProps: ['density']},
@@ -84,7 +84,7 @@ export const docs = {
},
{
name: 'XDSChatComposer',
- description: 'Layout shell for a chat composer. Arranges named slots (attachments, header, input, footer, send) with page-radius container, hover/focus shadows, and concentric inner radius for child elements.',
+ description: 'Layout shell for a chat composer. Arranges named slots (drawer, header, input, footer, send) with page-radius container, hover/focus shadows, and concentric inner radius for child elements.',
props: [
{name: 'onSubmit', type: '(value: string) => void', description: 'Called when the user submits a message.', required: true},
{name: 'onStop', type: '() => void', description: 'Called when the user requests to stop generation.'},
@@ -94,7 +94,7 @@ export const docs = {
{name: 'placeholder', type: 'string', description: 'Placeholder text.', default: "'Type a message\u2026'"},
{name: 'isDisabled', type: 'boolean', description: 'Disables the composer.', default: 'false'},
{name: 'density', type: "'compact' | 'balanced' | 'spacious'", description: 'Visual density.', default: "'balanced'"},
- {name: 'attachments', type: 'ReactNode', description: 'Slot: attachment chips above the input. Use XDSChatComposerAttachments.'},
+ {name: 'drawer', type: 'ReactNode', description: 'Slot: collapsible drawer above the input — attachments, context chips, etc. Use XDSChatComposerDrawer.'},
{name: 'headerActions', type: 'ReactNode', description: 'Slot: left-aligned header actions (attach, mention buttons). Use icon-only size="sm" buttons.'},
{name: 'headerContext', type: 'ReactNode', description: 'Slot: right-aligned contextual info in the header (context window usage, XDSProgressBar, supporting text).'},
{name: 'input', type: 'ReactNode', description: 'Slot: custom input element. Replaces the default textarea. Use XDSChatComposerInput for trigger menus.'},
@@ -125,8 +125,8 @@ export const docs = {
],
},
{
- name: 'XDSChatComposerAttachments',
- description: 'Flex-wrap container for attachment items (tokens, thumbnails, previews) inside the composer.',
+ name: 'XDSChatComposerDrawer',
+ description: 'Collapsible drawer panel for the composer. Use for attachments, context chips, or any supplementary content above the input.',
props: [
{name: 'children', type: 'ReactNode', description: 'Attachment items to render.', required: true},
{name: 'count', type: 'number', description: 'Total attachment count. When provided and exceeds visible children, shows a collapse/expand toggle.'},
@@ -170,7 +170,7 @@ export const docs = {
description: 'Chat builds conversational interfaces — AI assistants, messaging, or any thread-based UI. Compose with MessageList > Message > Bubble for sender-aware styling, density, and accessible markup out of the box.',
bestPractices: [
{ guidance: true, description: 'Compose messages using MessageList > Message > Bubble for consistent sender-aware styling and density.' },
- { guidance: true, description: 'Use the named slots on XDSChatComposer (attachments, headerActions, footerActions) to keep the input layout structured and extensible.' },
+ { guidance: true, description: 'Use the named slots on XDSChatComposer (drawer, headerActions, footerActions) to keep the input layout structured and extensible.' },
{ guidance: true, description: 'Put name and metadata on the bubble when the content has a visible bubble boundary. Put them on the message wrapper when the content is raw (no bubble).' },
{ guidance: true, description: 'Use XDSChatLayout for full-page chat — it handles auto-scroll, density adaptation, and composer docking automatically.' },
{ guidance: false, description: 'Place metadata or names on both the bubble and the message wrapper — pick one based on whether the content has a bubble boundary.' },
@@ -210,7 +210,7 @@ export const docsZh = {
description: 'Chat builds conversational interfaces — AI assistants, messaging, or any thread-based UI. Compose with MessageList > Message > Bubble for sender-aware styling, density, and accessible markup out of the box.',
bestPractices: [
{ guidance: true, description: 'Compose messages using MessageList > Message > Bubble for consistent sender-aware styling and density.' },
- { guidance: true, description: 'Use the named slots on XDSChatComposer (attachments, headerActions, footerActions) to keep the input layout structured and extensible.' },
+ { guidance: true, description: 'Use the named slots on XDSChatComposer (drawer, headerActions, footerActions) to keep the input layout structured and extensible.' },
{ guidance: true, description: 'Put name and metadata on the bubble when the content has a visible bubble boundary. Put them on the message wrapper when the content is raw (no bubble).' },
{ guidance: true, description: 'Use XDSChatLayout for full-page chat — it handles auto-scroll, density adaptation, and composer docking automatically.' },
{ guidance: false, description: 'Place metadata or names on both the bubble and the message wrapper — pick one based on whether the content has a bubble boundary.' },
@@ -273,7 +273,7 @@ export const docsZh = {
placeholder: '占位文本。',
isDisabled: '禁用编写器。',
density: '视觉密度。',
- attachments: '插槽:输入上方的附件标签。使用 XDSChatComposerAttachments。',
+ drawer: '插槽:输入上方的可折叠抽屉——附件、上下文标签等。使用 XDSChatComposerDrawer。',
headerActions: '插槽:标题左侧操作按钮(附件、提及按钮)。使用仅图标 size="sm" 按钮。',
headerContext: '插槽:标题右侧上下文信息(上下文窗口使用情况、XDSProgressBar、辅助文本)。',
input: '插槽:自定义输入元素。替换默认文本区域。使用 XDSChatComposerInput 实现触发菜单。',
@@ -305,8 +305,8 @@ export const docsZh = {
},
},
{
- name: 'XDSChatComposerAttachments',
- description: '编写器内附件项目的弹性换行容器。',
+ name: 'XDSChatComposerDrawer',
+ description: '编写器的可折叠抽屉面板。用于附件、上下文标签或输入上方的任何补充内容。',
propDescriptions: {children: '要渲染的附件项目。', count: '附件总数。超过可见子元素时显示折叠/展开切换。'},
},
{
@@ -369,7 +369,7 @@ export const docsDense = {
description: 'Chat builds conversational interfaces — AI assistants, messaging, or any thread-based UI. Compose with MessageList > Message > Bubble for sender-aware styling, density, and accessible markup out of the box.',
bestPractices: [
{ guidance: true, description: 'Compose messages using MessageList > Message > Bubble for consistent sender-aware styling and density.' },
- { guidance: true, description: 'Use the named slots on XDSChatComposer (attachments, headerActions, footerActions) to keep the input layout structured and extensible.' },
+ { guidance: true, description: 'Use the named slots on XDSChatComposer (drawer, headerActions, footerActions) to keep the input layout structured and extensible.' },
{ guidance: true, description: 'Put name and metadata on the bubble when the content has a visible bubble boundary. Put them on the message wrapper when the content is raw (no bubble).' },
{ guidance: true, description: 'Use XDSChatLayout for full-page chat — it handles auto-scroll, density adaptation, and composer docking automatically.' },
{ guidance: false, description: 'Place metadata or names on both the bubble and the message wrapper — pick one based on whether the content has a bubble boundary.' },
@@ -430,7 +430,7 @@ export const docsDense = {
},
{
name: 'XDSChatComposer',
- description: 'composer layout shell; named slots (attachments/header/input/footer/send) w/ page-radius + concentric inner radius',
+ description: 'composer layout shell; named slots (drawer/header/input/footer/send) w/ page-radius + concentric inner radius',
propDescriptions: {
onSubmit: 'submit msg handler',
onStop: 'stop generation handler',
@@ -440,7 +440,7 @@ export const docsDense = {
placeholder: 'placeholder text',
isDisabled: 'disabled state',
density: 'visual density',
- attachments: 'slot: attachment chips above input; use XDSChatComposerAttachments',
+ drawer: 'slot: collapsible drawer above input — attachments, context chips, etc.; use XDSChatComposerDrawer',
headerActions: 'slot: left header actions (attach, mention); icon-only sm buttons',
headerContext: 'slot: right header context info (window usage, XDSProgressBar, text)',
input: 'slot: custom input; replaces default textarea; use XDSChatComposerInput for triggers',
@@ -471,8 +471,8 @@ export const docsDense = {
},
},
{
- name: 'XDSChatComposerAttachments',
- description: 'flex-wrap container for attachment items in composer',
+ name: 'XDSChatComposerDrawer',
+ description: 'collapsible drawer panel for composer; use for attachments, context chips, or supplementary content',
propDescriptions: {
children: 'attachment items to render',
count: 'total count; shows collapse/expand when exceeds visible',
diff --git a/packages/core/src/Chat/README.md b/packages/core/src/Chat/README.md
index a7eee00510..c0fe05990c 100644
--- a/packages/core/src/Chat/README.md
+++ b/packages/core/src/Chat/README.md
@@ -4,20 +4,20 @@ Chat components for AI chat interfaces — layout (messages, bubbles) and compos
## Files
-| File | Purpose |
-|------|---------|
-| `XDSChatMessageList.tsx` | Scrollable message container with auto-scroll and infinite scroll |
-| `XDSChatMessage.tsx` | Sender context wrapper — avatar, name, alignment by role |
-| `XDSChatMessageBubble.tsx` | Styled bubble container — reads sender from context |
-| `XDSChatMessageMetadata.tsx` | Timestamp + status display for bubbles |
-| `XDSChatSystemMessage.tsx` | Centered system/notice messages with optional divider |
-| `XDSChatComposer.tsx` | Layout shell with named slots, concentric radius, hover shadows |
-| `XDSChatComposerInput.tsx` | ContentEditable with trigger menus, tokens, history, paste/drop |
-| `XDSChatComposerAttachments.tsx` | Flex-wrap container for attachment items |
-| `useTriggerMenu.tsx` | Internal hook — trigger detection, popover, keyboard nav, search |
-| `useAutoScroll.ts` | Internal hook — auto-scroll and "new messages" detection |
-| `XDSChatContext.tsx` | Internal React contexts for sender and density propagation |
-| `index.ts` | Public exports |
+| File | Purpose |
+| ---------------------------- | ----------------------------------------------------------------- |
+| `XDSChatMessageList.tsx` | Scrollable message container with auto-scroll and infinite scroll |
+| `XDSChatMessage.tsx` | Sender context wrapper — avatar, name, alignment by role |
+| `XDSChatMessageBubble.tsx` | Styled bubble container — reads sender from context |
+| `XDSChatMessageMetadata.tsx` | Timestamp + status display for bubbles |
+| `XDSChatSystemMessage.tsx` | Centered system/notice messages with optional divider |
+| `XDSChatComposer.tsx` | Layout shell with named slots, concentric radius, hover shadows |
+| `XDSChatComposerInput.tsx` | ContentEditable with trigger menus, tokens, history, paste/drop |
+| `XDSChatComposerDrawer.tsx` | Collapsible drawer panel for supplementary content |
+| `useTriggerMenu.tsx` | Internal hook — trigger detection, popover, keyboard nav, search |
+| `useAutoScroll.ts` | Internal hook — auto-scroll and "new messages" detection |
+| `XDSChatContext.tsx` | Internal React contexts for sender and density propagation |
+| `index.ts` | Public exports |
## Architecture
@@ -29,7 +29,7 @@ XDSChatMessageList — scrollable container, auto-scroll
(any other content) — asset lists, tool calls, images
XDSChatComposer — layout shell with named slots
- XDSChatComposerAttachments — attachment tokens/thumbnails
+ XDSChatComposerDrawer — collapsible drawer (attachments, context, etc.)
XDSChatComposerInput — contentEditable with trigger menus
useTriggerMenu — @ mentions, / commands via XDSSearchSource
```
@@ -45,10 +45,10 @@ Both contexts are internal (not exported). Only types are public.
### Component CSS Vars
-| Var | Default | Description |
-|-----|---------|-------------|
-| `--composer-radius` | `var(--radius-page)` | Border radius of the composer body |
-| `--composer-padding` | `var(--spacing-3)` | Padding of the composer body |
+| Var | Default | Description |
+| -------------------- | -------------------- | ---------------------------------- |
+| `--composer-radius` | `var(--radius-page)` | Border radius of the composer body |
+| `--composer-padding` | `var(--spacing-3)` | Padding of the composer body |
### Concentric Radius
@@ -80,7 +80,8 @@ defineTheme({
### Theming Targets
-| Class | Variants | States |
-|-------|----------|--------|
-| `xds-chat-composer` | density | — |
-| `xds-chat-composer-input` | — | — |
+| Class | Variants | States |
+| -------------------------- | --------- | ------ |
+| `xds-chat-composer` | density | — |
+| `xds-chat-composer-input` | — | — |
+| `xds-chat-composer-drawer` | collapsed | — |
diff --git a/packages/core/src/Chat/XDSChatComposer.tsx b/packages/core/src/Chat/XDSChatComposer.tsx
index ba4d84a5e9..e564f60ed2 100644
--- a/packages/core/src/Chat/XDSChatComposer.tsx
+++ b/packages/core/src/Chat/XDSChatComposer.tsx
@@ -6,7 +6,7 @@
* @output Exports XDSChatComposer layout shell component
* @position Core implementation; consumed by index.ts
*
- * Layout shell for a chat composer. Arranges slots (attachments, header,
+ * Layout shell for a chat composer. Arranges slots (drawer, header,
* input, footer actions, send button, status) in a vertical stack with
* page-radius container, hover/focus shadows, and concentric inner radius.
*
@@ -81,8 +81,8 @@ export interface XDSChatComposerProps extends Omit<
// --- Slot props ---
- /** Attachment chips rendered above the input */
- attachments?: ReactNode;
+ /** Collapsible drawer rendered above the input — attachments, context chips, etc. Use XDSChatComposerDrawer. */
+ drawer?: ReactNode;
/** Actions rendered on the left side of the header (e.g. attach, mention buttons). Use icon-only `size="sm"` buttons. */
headerActions?: ReactNode;
/** Contextual info rendered on the right side of the header (e.g. context window usage, XDSProgressBar). */
@@ -250,7 +250,7 @@ const styles = stylex.create({
// =============================================================================
/**
- * Layout shell for a chat composer with slots for attachments, input,
+ * Layout shell for a chat composer with slots for drawer, input,
* actions, and a send button.
*
* @example
@@ -271,7 +271,7 @@ export function XDSChatComposer(props: XDSChatComposerProps) {
placeholder = 'Type a message\u2026',
isDisabled = false,
density = 'balanced',
- attachments,
+ drawer,
headerActions,
headerContext,
input,
@@ -381,7 +381,7 @@ export function XDSChatComposer(props: XDSChatComposerProps) {
)}
{...rest}>
{statusPosition === 'top' && statusEl}
- {attachments}
+ {drawer}
<div
ref={bodyRef}
diff --git a/packages/core/src/Chat/XDSChatComposerAttachments.tsx b/packages/core/src/Chat/XDSChatComposerDrawer.tsx
similarity index 90%
rename from packages/core/src/Chat/XDSChatComposerAttachments.tsx
rename to packages/core/src/Chat/XDSChatComposerDrawer.tsx
index 58a81baa35..7935c83343 100644
--- a/packages/core/src/Chat/XDSChatComposerAttachments.tsx
+++ b/packages/core/src/Chat/XDSChatComposerDrawer.tsx
@@ -1,10 +1,10 @@
'use client';
/**
- * @file XDSChatComposerAttachments.tsx
+ * @file XDSChatComposerDrawer.tsx
* @input Uses React, StyleX, theme tokens
- * @output Exports XDSChatComposerAttachments component
- * @position Layout container for attachment items inside XDSChatComposer.
+ * @output Exports XDSChatComposerDrawer component
+ * @position Collapsible drawer panel for XDSChatComposer.
* Supports expanded (full content) and collapsed (count + label) states
* with fade animation and grid-template-rows height transition.
*
@@ -27,20 +27,20 @@ import {XDSBadge} from '../Badge';
import {xdsClassName, mergeProps} from '../utils';
import type {XDSBaseProps} from '../XDSBaseProps';
-export interface XDSChatComposerAttachmentsProps extends XDSBaseProps<HTMLDivElement> {
+export interface XDSChatComposerDrawerProps extends XDSBaseProps<HTMLDivElement> {
ref?: React.Ref<HTMLDivElement>;
/**
- * Attachment items — thumbnails, tokens, previews.
+ * Content to render inside the drawer — attachments, context chips, previews, etc.
*/
children: ReactNode;
/**
- * Total attachment count — shown in the collapsed badge.
+ * Total item count — shown in the collapsed badge.
* When omitted, the component doesn't support collapse.
*/
count?: number;
/**
* Label shown next to the count in collapsed state.
- * @default 'Attachments'
+ * @default 'Items'
*/
label?: string;
/**
@@ -189,22 +189,22 @@ const styles = stylex.create({
});
/**
- * Container for attachment previews inside a chat composer.
- * Supports collapsible behavior with a count badge.
+ * Collapsible drawer panel for a chat composer.
+ * Use for attachments, context chips, or any supplementary content above the input.
*
* @example
* ```
- * <XDSChatComposerAttachments count={3}>
+ * <XDSChatComposerDrawer count={3}>
* <AttachmentThumbnail />
* <AttachmentThumbnail />
- * </XDSChatComposerAttachments>
+ * </XDSChatComposerDrawer>
* ```
*/
-export function XDSChatComposerAttachments({
+export function XDSChatComposerDrawer({
ref,
children,
count,
- label = 'Attachments',
+ label = 'Items',
isCollapsed: controlledCollapsed,
defaultIsCollapsed = false,
onCollapsedChange,
@@ -213,7 +213,7 @@ export function XDSChatComposerAttachments({
style,
'data-testid': testId,
...htmlProps
-}: XDSChatComposerAttachmentsProps): React.ReactElement {
+}: XDSChatComposerDrawerProps): React.ReactElement {
const [internalCollapsed, setInternalCollapsed] =
useState(defaultIsCollapsed);
const isControlled = controlledCollapsed !== undefined;
@@ -232,7 +232,7 @@ export function XDSChatComposerAttachments({
ref={ref}
data-testid={testId}
{...mergeProps(
- xdsClassName('chat-composer-attachments', {
+ xdsClassName('chat-composer-drawer', {
collapsed: isCollapsed ? 'collapsed' : null,
}),
stylex.props(styles.root, xstyle),
@@ -292,4 +292,4 @@ export function XDSChatComposerAttachments({
);
}
-XDSChatComposerAttachments.displayName = 'XDSChatComposerAttachments';
+XDSChatComposerDrawer.displayName = 'XDSChatComposerDrawer';
diff --git a/packages/core/src/Chat/index.ts b/packages/core/src/Chat/index.ts
index 427332427b..146a7ccb74 100644
--- a/packages/core/src/Chat/index.ts
+++ b/packages/core/src/Chat/index.ts
@@ -16,8 +16,8 @@ export type {
export {XDSChatSendButton} from './XDSChatSendButton';
export type {XDSChatSendButtonProps} from './XDSChatSendButton';
-export {XDSChatComposerAttachments} from './XDSChatComposerAttachments';
-export type {XDSChatComposerAttachmentsProps} from './XDSChatComposerAttachments';
+export {XDSChatComposerDrawer} from './XDSChatComposerDrawer';
+export type {XDSChatComposerDrawerProps} from './XDSChatComposerDrawer';
export {
XDSChatComposerInput,