EXEPERTAI LAB

Research alpha

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

Chat Composer

Layout shell for a chat composer. Arranges named slots (drawer, header, input, footer, send) with page-radius container, elevation, a keyboard-only editor focus ring, and concentric inner radius for child elements.

Open in Playground @astryxdesign/core/Chat

Showcases and examples

8 documented examples

Chat Composer

ChatComposer API entry

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

'use client';

import {ChatComposer} from '@astryxdesign/core/Chat';
import {Stack} from '@astryxdesign/core/Layout';

export default function ChatComposerShowcase() {
  return (
    <Stack direction="vertical" width={450} maxWidth="100%">
      <ChatComposer onSubmit={() => {}} placeholder="Type a message…" />
    </Stack>
  );
}

Usage

ChatComposer is the message-entry shell for a chat surface. It coordinates a controlled or uncontrolled draft, provides a default token-capable input and send/stop action, and arranges optional drawer, header, footer, and status content. Custom inputs and send controls can join the same value, submission, disabled, stop, and focus contract through useChatComposerContext().

Typed props

PropType and behavior
onSubmit(value: string) => void · required
Called when the user submits a message.
onStop() => void
Called when the user requests to stop generation.
isStopShownboolean · default false
Whether the stop button is shown instead of the send button.
valuestring
Controlled input value.
onChange(value: string) => void
Change handler for controlled mode.
placeholderstring · default 'Type a message...'
Placeholder text shown when the input is empty.
isDisabledboolean · default false
Disables the composer.
density'compact' | 'balanced' | 'spacious' · default 'balanced'
Visual density.
elevation'none' | 'low' · default 'low'
Resting elevation of the composer body. low (the default) keeps today's raised look: low at rest, bumping to med on hover / focus. none flattens it and draws a border. Keyboard focus in the editor adds the shared focus ring in either presentation; pointer focus does not add that ring.
drawerReactNode
Slot: collapsible drawer above the input: attachments, context chips, etc. Use ChatComposerDrawer.
Slot: Text
headerActionsReactNode
Slot: left-aligned header actions (attach, mention buttons). Use icon-only size="sm" buttons.
Slot: Button
headerContextReactNode
Slot: right-aligned contextual info in the header (context window usage, ProgressBar, supporting text).
Slot: Text
inputReactNode
Slot: custom input element. Replaces the default input. Use ChatComposerInput for trigger menus/tokens, or wire any input (plain textarea, rich editor) to the composition contract via useChatComposerContext(): read value/onChange/onSubmit/canSend and register a focus control on inputControlRef so body-click-to-focus works.
Slot: TextInput
footerActionsReactNode
Slot: left-aligned footer actions (model selector, etc).
Slot: Button
sendActionsReactNode
Slot: actions to the left of the send button.
Slot: Button
sendButtonReactNode
Slot: custom send button. Replaces the default send/stop button.
Slot: Button
status{ type: 'error' | 'warning'; message?: string }
Status message rendered below (or above) the composer.
statusPosition'top' | 'bottom' · default 'bottom'
Where to render the status.

Anatomy

Composer frame · required

Outer composition root that groups the body with an optional status message above or below it.

Composer body · required

Rounded, elevated surface containing the header, input, and footer.

Drawer · optional

Content before the body for attachments or other expandable context, typically ChatComposerDrawer.

Header · optional

Row for start-aligned actions and end-aligned contextual information.

Input · required

Default ChatComposerInput or a custom editor connected through useChatComposerContext().

Footer · required

Row for caller-supplied footer and send actions plus the primary action.

Send or stop action · required

Default ChatSendButton or a custom sendButton; it submits the current draft or requests interruption.

Status message · optional

Error or warning feedback rendered before or after the composer body.