Astryx

Astryx Chat Composer

Component

About

An Astryx chat-composer shell arranging input, drawer, header, footer, send actions, status, and keyboard focus behavior.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Astryx Chat Composer to your project and fits it to your theme.

Code

How Astryx Chat Composer is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

'use client';

import {useState} from 'react';
import {ChatComposer} from '@/components/ui/astryx-chat-composer';
import {Stack} from '@astryxdesign/core/Layout';
import {Text} from '@astryxdesign/core/Text';

function ChatComposerStreaming() {
  const [isStreaming, setIsStreaming] = useState(false);
  const [value, setValue] = useState(
    'Click the send button to start streaming.',
  );

  return (
    <Stack direction="vertical" gap={4} width={450} maxWidth="100%">
      <Stack direction="vertical" gap={1}>
        <Text type="supporting" color="secondary">
          {isStreaming
            ? 'Streaming — click stop to cancel'
            : 'Send a message to start streaming'}
        </Text>
        <ChatComposer
          value={value}
          onChange={setValue}
          onSubmit={value => {
            console.log('Sent:', value);
            setValue('');
            setIsStreaming(true);
            setTimeout(() => setIsStreaming(false), 5000);
          }}
          isStopShown={isStreaming}
          onStop={() => {
            console.log('Stopped');
            setIsStreaming(false);
          }}
          placeholder="Send a message to start streaming..."
        />
      </Stack>
    </Stack>
  );
}

export default function ChatComposerStreamingDemo() {
  return (
    <div
      data-astryx-theme="neutral"
      data-theme="light"
      style={{colorScheme: 'light', display: 'contents'}}>
      <ChatComposerStreaming />
    </div>
  );
}

Dependencies

More by Astryx

View all
  • Astryx Banner

    Astryx Banner

    61
  • Astryx Avatar

    Astryx Avatar

    32
  • Astryx Aspect Ratio

    Astryx Aspect Ratio

    32
  • Astryx Badge

    Astryx Badge

    29
  • Astryx Button Group

    Astryx Button Group

    28
  • Astryx Chat Composer Drawer

    Astryx Chat Composer Drawer

    25
  • Astryx Toggle Button

    Astryx Toggle Button

    17
  • Astryx Chat Tokenized Text

    Astryx Chat Tokenized Text

    9