ChatPromptSubmit
The prompt's button: send, stop while the answer is on its way, retry after an error.
On this page
Examples
By status
Send is a submit button and works in static rendering; stop and retry need interactivity.
Idle
Submitted
Streaming
Error
No click yet
Razor
@* Inside a KlyChatPrompt the button follows its Status. Standalone, give it one. Stop and retry need interactivity. *@
<div class="flex flex-wrap items-center gap-6" data-testid="chat-prompt-submit-example">
@foreach (var status in Enum.GetValues<ChatStatus>())
{
<div class="flex flex-col items-center gap-2 text-xs text-(--klyroo-text-muted)">
<KlyChatPromptSubmit Status="status" OnStop="Stop" OnReload="Retry"
data-testid="@($"chat-submit-{status.ToString().ToLowerInvariant()}")" />
@status
</div>
}
<p class="text-sm" role="status" data-testid="chat-submit-event">@(_event is null ? "No click yet" : $"Clicked: {_event}")</p>
</div>
@code {
private string? _event;
private void Stop() => _event = "stop";
private void Retry() => _event = "retry";
}API
KlyChatPromptSubmit
Button of a chat prompt that sends, stops or retries according to the chat status.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
Class |
string |
Classes added to the root element, merged last so they win over the theme. | |
Color |
KlyColor? |
The color of the send button. The stop and retry buttons keep their own. Values: primary, secondary, success, info, warning, error, neutral. |
|
Disabled |
bool |
false |
Disables the button. |
Label |
string |
Accessible name. Defaults to the built-in text for the status. | |
Size |
KlySize |
KlySize. |
Size of the button, from Xs to Xl . Values: Xs, Sm, Md, Lg, Xl. |
Status |
ChatStatus? |
The status to show. Defaults to the one of the enclosing KlyChatPrompt . Values: Idle, Submitted, Streaming, Error. |
|
Ui |
Chat |
Per-instance class overrides of the slots of the chat prompt submit, see ChatPromptSubmitUi . They are merged after the theme and the Class parameter wins on the root slot. |
Events
| Name | Type | Description |
|---|---|---|
OnReload |
EventCallback |
Called when the button is pressed after an error. |
OnStop |
EventCallback |
Called when the button is pressed while the answer is submitted or streaming. |
Ui slots
Ui takes a Chat with one class string per slot, merged after the theme.
| Slot | Styles |
|---|---|
Base |
Classes merged into the base slot of KlyChatPromptSubmit , after the theme and the app configuration. |
Icon |
Classes merged into the icon slot of KlyChatPromptSubmit , after the theme and the app configuration. |
StopIcon |
Classes merged into the stopIcon slot of KlyChatPromptSubmit , after the theme and the app configuration. |