XDSChatSendButton@xds/core · Chat

Usage

XDSChatMessageList is the scrollable container for chat messages. It renders children in a flex column with role="log" for accessibility, provides density context to child messages, and supports infinite scroll for loading older messages. Use it inside XDSChatLayout for full-page chat with auto-scroll and composer docking, or standalone for embedded message panels.

Best practices

GuidancePractices
DoCompose messages using MessageList > Message > Bubble for consistent sender-aware styling and density.
DoSet the density prop to control spacing globally — compact for sidebars, balanced for most views, spacious for long-form reading. Individual messages can override.
DoUse the group prop on bubbles (first, middle, last) when a single sender sends multiple consecutive messages — it tightens corner radius to visually connect them.
DoUse XDSChatSystemMessage with variant="divider" for date separators and default for inline status notices like joins, leaves, or topic changes.
DoPut name on the first bubble and metadata on the last bubble in a message so they align with the bubble's inline padding.
DoProvide an emptyState prop so new users see a clear prompt to start a conversation instead of a blank screen.
DoUse the ghost bubble variant for AI-style responses that show rich content like code blocks or markdown without a visible boundary.
Don'tDon't use XDSChatSystemMessage for sender content — it has no avatar, alignment, or bubble. Use XDSChatMessage with a sender role instead.
Don'tDon'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.
Don'tDon't nest XDSChatMessage inside another XDSChatMessage — each message is a standalone article element with its own sender context.
Don'tDon't apply a fixed height directly on the message list — wrap it in a sized container and let the list fill with flex: 1.
Don'tDon't mix filled and ghost bubble variants within the same sender's messages — pick one style per side and use it consistently.
Don'tDon't place metadata or names on both the bubble and the message wrapper — pick one based on whether the content has a bubble boundary.

Anatomy

ElementDescription
Message arearequiredScrollable region for messages. Renders children (typically XDSChatMessageList) in a flex column that pushes content to the bottom when the list is short.
Frosted glass dockrequiredSticky or fixed container at the bottom with a backdrop-blur layer. Houses the scroll button and composer.
Scroll-to-bottom buttonAppears when the user scrolls up or new messages arrive. Defaults to XDSChatLayoutScrollButton; pass null to hide or a custom element to override.
ComposerrequiredThe input area for sending messages, typically XDSChatComposer. Docked at the bottom inside the frosted glass layer.
Empty stateCentered placeholder shown when no messages exist. Use XDSEmptyState for a consistent look.
AvatarA sender avatar rendered beside the message. Typically XDSAvatar with size="small". Hidden for system messages.
NameSender name above the message body. Place on the bubble when using bubbles, or on the message wrapper for raw content.
ContentrequiredThe message body — one or more XDSChatMessageBubble elements, or any free-form ReactNode like images or tool calls.
MetadataTimestamp, delivery status, and footer actions below the message. Place on the last bubble or on the message wrapper.

Import

ts
import {XDSChatSendButton} from '@xds/core/Chat'

Props

PropTypeDescription
isStreaming
booleanWhether the assistant is currently streaming. Defaults to context value.
isDisabled
booleanWhether the send button is disabled. Defaults to !canSend from context.
onSend
() => voidCalled when the user clicks send. Defaults to context onSubmit.
onStop
() => voidCalled when the user clicks stop during streaming. Defaults to context onStop.
sendIcon
ReactNodeCustom icon for the send state. Defaults to arrowUp from icon registry.
stopIcon
ReactNodeCustom icon for the stop state. Defaults to stop from icon registry.
size
'sm' | 'md' (default: 'md')Button size.
xstyle
StyleXStylesStyleX styles for layout customization (margins, positioning, sizing). Must be a stylex.create() value — not an inline style object like style={{}}.

Examples

Common configurations, variations, and states.
ChatSendButton — Custom Icon
tsx
'use client';
import {XDSChatSendButton} from '@xds/core/Chat';
import {XDSIcon} from '@xds/core/Icon';
import {XDSStack} from '@xds/core/Layout';
import {XDSText} from '@xds/core/Text';
import {
CheckIcon,
PaperAirplaneIcon,
SparklesIcon,
} from '@heroicons/react/24/solid';
import {XCircleIcon} from '@heroicons/react/24/outline';
export default function ChatSendButtonCustomIcon() {
return (
<XDSStack direction="vertical" gap={4}>
<XDSText type="supporting" color="secondary">
Custom icons for send and stop states
</XDSText>
<XDSStack direction="horizontal" gap={4} vAlign="center">
<XDSChatSendButton
isDisabled={false}
onSend={() => {}}
sendIcon={<XDSIcon icon={PaperAirplaneIcon} size="sm" />}
/>
<XDSChatSendButton
isDisabled={false}
onSend={() => {}}
sendIcon={<XDSIcon icon={CheckIcon} size="sm" />}
/>
<XDSChatSendButton
isDisabled={false}
onSend={() => {}}
sendIcon={<XDSIcon icon={SparklesIcon} size="sm" />}
/>
<XDSChatSendButton
isStreaming
onStop={() => {}}
stopIcon={<XDSIcon icon={XCircleIcon} size="sm" />}
/>
</XDSStack>
</XDSStack>
);
}
ChatSendButton — In ComposerSend button inside XDSChatComposer, where it reads state from context automatically. No wiring needed — the button enables when the input has content.
tsx
'use client';
import * as stylex from '@stylexjs/stylex';
import {XDSChatComposer} from '@xds/core/Chat';
import {XDSStack} from '@xds/core/Layout';
const styles = stylex.create({
root: {
maxWidth: 450,
},
});
export default function ChatSendButtonInComposer() {
return (
<XDSStack direction="vertical" width="100%" xstyle={styles.root}>
<XDSChatComposer
onSubmit={() => {}}
value="Hello, how can you help?"
onChange={() => {}}
/>
</XDSStack>
);
}
ChatSendButton — StatesDisabled, ready, and streaming states at both sizes. The button automatically toggles between send (primary) and stop (secondary) based on streaming state.
tsx
'use client';
import {XDSChatSendButton} from '@xds/core/Chat';
import {XDSStack} from '@xds/core/Layout';
import {XDSText} from '@xds/core/Text';
export default function ChatSendButtonStates() {
return (
<XDSStack direction="vertical" gap={2}>
<XDSText type="supporting" color="secondary">
DisabledReadyStreaming
</XDSText>
<XDSStack direction="horizontal" gap={3} vAlign="center">
<XDSChatSendButton isDisabled onSend={() => {}} />
<XDSChatSendButton isDisabled={false} onSend={() => {}} />
<XDSChatSendButton isStreaming onStop={() => {}} />
</XDSStack>
</XDSStack>
);
}

Showcase source

tsx
'use client';
import {XDSChatSendButton} from '@xds/core/Chat';
import {XDSIcon} from '@xds/core/Icon';
import {XDSStack} from '@xds/core/Layout';
import {SparklesIcon} from '@heroicons/react/24/solid';
export default function ChatSendButtonShowcase() {
return (
<XDSStack direction="horizontal" gap={3} vAlign="center">
<XDSChatSendButton isDisabled={false} onSend={() => {}} />
<XDSChatSendButton
isDisabled={false}
onSend={() => {}}
sendIcon={<XDSIcon icon={SparklesIcon} size="sm" />}
/>
<XDSChatSendButton isStreaming onStop={() => {}} />
</XDSStack>
);
}