EXEPERTAI LAB

Research alpha

Time Machine
EXEPERTAI LAB
GALLERY / COLLECTION
← Browse Astryx gallery
Chat·component·@astryxdesign/core

Chat Send Button

Circular send/stop toggle button for the chat composer. Place it inside ChatComposer where it reads context automatically: no wiring needed. When streaming starts, the button switches from a primary send icon to a secondary stop icon. Override any context value via props for standalone or custom usage.

Open in Playground @astryxdesign/core/Chat

Showcases and examples

4 documented examples

Chat Send Button

Ready, custom icon, and streaming states of the send button.

Preview loads on approachPreview loads on approach
Exact source · chat-send-button-showcase
// Copyright (c) Meta Platforms, Inc. and affiliates.

'use client';

import {ChatSendButton} from '@astryxdesign/core/Chat';
import {Icon} from '@astryxdesign/core/Icon';
import {Stack} from '@astryxdesign/core/Layout';
import {SparklesIcon} from '@heroicons/react/24/solid';

export default function ChatSendButtonShowcase() {
  return (
    <Stack direction="horizontal" gap={3} vAlign="center">
      <ChatSendButton isDisabled={false} onSend={() => {}} />
      <ChatSendButton
        isDisabled={false}
        onSend={() => {}}
        sendIcon={<Icon icon={SparklesIcon} size="sm" />}
      />
      <ChatSendButton isStopShown onStop={() => {}} />
    </Stack>
  );
}

Usage

Use ChatSendButton as ChatComposer’s send control when the action should switch between sending and stopping. Inside ChatComposer it reads readiness, streaming state, and action callbacks from context; standalone usage supplies those values explicitly.

  • Place ChatSendButton inside ChatComposer when its readiness and send or stop lifecycle should follow composer context.
  • For standalone use, provide the state and matching onSend or onStop callback explicitly.
  • Keep the translated Send or Stop accessible name intact when supplying custom icon artwork; the icon is decorative and must not be the only name source.
  • Do not render the stop state without a working onStop callback from props or ChatComposer context.
  • Do not expect isDisabled to disable the stop action; it applies only to the send state.

Typed props

PropType and behavior
isStopShownboolean
Whether the stop button is shown. Defaults to context value.
isDisabledboolean
Whether the send button is disabled. Defaults to !canSend from context.
onSend() => void
Called when the user clicks send. Defaults to context onSubmit.
onStop() => void
Called when the user clicks stop during streaming. Defaults to context onStop.
sendIconReactNode
Custom icon for the send state. Defaults to arrowUp from icon registry.
Slot: Icon
stopIconReactNode
Custom icon for the stop state. Defaults to stop from icon registry.
Slot: Icon
size'sm' | 'md' · default 'md'
Button size.
xstyleStyleXStyles
StyleX styles for layout customization (margins, positioning, sizing). Must be a stylex.create() value: not an inline style object like style={{}}.

Anatomy

Action button · required

Circular icon-only Button that exposes the translated Send or Stop name and carries the chat-send-button theme target.