Skip to content
Components / AI chat

Chat composer

The message field with tools, attachments, send and stop.

@fabrials/ai-ui
Loading state
  • moonlight.pngPNG · 242 KB
  • quarterly-report-with-a-very-long-filename-final-v3.pdfPDF · 3.2 MB

Nothing is sent. Press Enter to try it.

Installation

  1. Import the control from @fabrials/ai-ui, after setting the app up.

    TypeScript
    import { ChatComposer, ComposerToggle, ComposerButton } from "@fabrials/ai-ui";import "@fabrials/ai-ui/styles.css";

API reference

Prop / exportTypeDescription
valuestringControlled with onValueChange. defaultValue works uncontrolled.
onSubmit(value) => voidEnter sends; Shift+Enter adds a line.
statusChatComposerStatusready, submitting or streaming. Streaming turns send into stop, which calls onStop.
toolsReactNodeComposerButton and ComposerToggle on the left. trailing holds voice input.
attachmentsReactNodeAttachments shown above the field.
onPasteFiles(files) => voidReceives pasted files. Backspace in an empty field calls the remove-last handler.

Behavior

Presentational. The host sends the message, uploads pasted files and owns the tool state.

Accessibility

Keyboard and contrast
Keep visible labels, keyboard focus and status announcements when customizing. These components inherit your theme; maintain sufficient contrast in both color modes. The preview is keyboard operable.