PromptSend
The send entry of Prompt: a send button while idle, a stop entry while loading and cancellable, and a loading state while loading but not cancellable. It reads disabled, loading and cancellable from Prompt, and it also works on its own.
Basic Usage
Place PromptSend in the send slot of Prompt to replace the internal send entry; disabled, loading and cancellable follow the Prompt automatically, so you rarely pass them yourself. The scope of the send slot is PromptSendScope, whose submit and cancel are the methods the click is wired to.
Used on its own, pass disabled and loading yourself: loading shows the loading state, and the click is not emitted while disabled or loading.
API
PromptSendScope is the scope Prompt passes to the send, start and end slots: submit and cancel submit and abort the input, while disabled, loading and cancellable carry the current state of Prompt.
PromptSendProps
| Attribute | Type | Optional | Default | Description | Version |
|---|---|---|---|---|---|
| disabled | boolean | True | false | Whether PromptSend is disabled. | 0.2.1 |
| loading | boolean | True | false | Whether PromptSend is loading. | 0.2.1 |
PromptSendEvents
| Event | Parameter | Description | Version |
|---|---|---|---|
| click | e: MouseEvent | Triggered when the send entry is clicked. | 0.2.1 |
PromptSendSlots
| Slot | Parameter | Description | Version |
|---|---|---|---|
| trigger | send: (e: MouseEvent) => void, disabled: boolean, loading: boolean, cancellable: boolean | The send entry area, replacing the internal button. | 0.2.1 |
| icon | loading: boolean, cancellable: boolean | The icon of the send entry. | 0.2.1 |
PromptSendScope
| Attribute | Type | Optional | Default | Description | Version |
|---|---|---|---|---|---|
| cancel | (e?: MouseEvent) => void | False | | Discards the current input. | 0.2.1 |
| submit | (e?: KeyboardEvent | MouseEvent) => void | False | | Submits the current input. | 0.2.1 |
| disabled | boolean | False | | Whether Prompt is disabled. | 0.2.1 |
| loading | boolean | False | | Whether Prompt is submitting. | 0.2.1 |
| cancellable | boolean | False | | Whether the submission can be aborted while Prompt is loading. | 0.2.1 |