composerSend
Wires a composer's send control.
import { composerSend } from "@sdxc/ui/chat";Usage
Put on an element inside a composer's form, around its send and stop buttons. It finds the
form's Composer.Input, and a click on a [data-slot="composer-stop"] inside it stops the
replay.
Signature
composerSend(options: ComposerSendOptions): MixinDescriptor<HTMLElement>Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
options | ComposerSendOptions | Yes |
Examples
<span mix={[composerSend({ stream: "reply-7", onStreamingChange: (on) => … })]}>…</span>Used with it
The events, constants and types its module publishes, each imported from @sdxc/ui/chat too.
Constant
COMPOSER_STOP_SLOT
The slot of the button that stops a streaming reply, inside the mixin's host.
const COMPOSER_STOP_SLOT = "composer-stop"Interface
ComposerSendOptions
Options for composerSend.
| Member | Type | Required | Description |
|---|---|---|---|
stream | string | No | The id of a reply the page just answered with, marked data-stream-pending; it replays as a stream, or shows at once under reduced motion. |
streamKey | string | No | Changes with every new reply, so a reply that reuses the previous one's id replays too. |
onStreamingChange | (streaming: boolean) => void | Yes | Told when a replay starts and ends, so the host can swap Send for Stop. |