Composer
Compose messages with attachments, agent and model controls, and send behavior.
Composer is the default Chakra surface for writing a message in a new or existing session. It owns the visual composition; the headless composer contract owns input, submission, and session state.
Usage
HyperflowApp mounts the Composer in its default session pages. When building a custom Chakra session page, render the component inside the Hyperflow application boundary:
import { Composer } from '@hyperflow/chakra-ui'
export function SessionComposer() {
return <Composer />
}The default surface includes the text input, attachments, send or stop behavior, and the available agent, model, toolhost, context-window, and approval controls.
Examples
Replace the text input
Use inputComponent to change the message field while keeping the Composer’s controlled value, keyboard handling, and submission behavior.
import {
Composer,
ComposerTextInput,
type ComposerTextInputProps,
} from '@hyperflow/chakra-ui'
function ProjectInput(props: ComposerTextInputProps) {
return <ComposerTextInput {...props} placeholder="Ask the project assistant" />
}
export function ProjectComposer() {
return <Composer inputComponent={ProjectInput} />
}Guide
Keep state in the Composer contract
Composer gets its draft, attachments, selected options, send state, and stop behavior from useComposer. Do not recreate that state or call the Hyperflow client from a replacement input or button.
Replace one visual part at a time
Use inputComponent, sendButtonComponent, attachmentMenuComponent, or attachmentPreviewComponent to replace one part of the surface. Each replacement receives a narrow prop contract from the parent Composer.
Customize the control slots
Pass slotRenderers to replace the agent, model, toolhost, context-window, or approval-policy control. Use slotSurfaceVariant="appendix" when the top and bottom slot regions should sit outside the Composer card.
For a complete customization walkthrough, see Customize the Composer.
Props
| Prop | Default | Type |
|---|---|---|
inputComponent | ComposerTextInput | ComponentType<ComposerTextInputProps>Replaces the controlled message field. |
sendButtonComponent | ComposerSendButton | ComponentType<ComposerSendButtonProps>Replaces the submit and stop control. |
attachmentMenuComponent | ComposerAttachmentMenu | ComponentType<ComposerAttachmentMenuProps>Replaces the attachment picker. |
attachmentPreviewComponent | ComposerAttachmentPreview | ComponentType<ComposerAttachmentPreviewProps>Replaces the selected-file preview list. |
slotRenderers | Built-in slot renderers | ComposerSlotRenderersReplaces individual agent, model, toolhost, context-window, or approval-policy controls. |
slotSurfaceVariant | "plain" | "plain" | "appendix"Renders top and bottom slot regions inside the card ( "plain") or as an appendix outside it ("appendix"). |
placement | "standalone" | "standalone" | "floating"Sets the visual context to "standalone" or "floating". |
dropTarget | Composer element | HTMLElement | nullSets the element that accepts dropped files. |
For the complete ComposerProps type, see the @hyperflow/chakra-ui reference.