Output Actions
The output actions are interactive controls shown on every generated output card in the Output
view of the AIPrompt. Users can click these actions to copy, retry, rate, or run custom logic against the specific AI response.
You can use the built-in actions or define custom actions to let users modify or further process the respective prompt response.
Built-in Actions
The AIPrompt supports the following built-in output actions:
Copy()
—Copies the output content to the clipboard. The action is displayed by default.Retry()
—Regenerates the output using the same prompt and settings. The action is displayed by default.Rating()
—Shows positive and negative rating buttons so users can provide feedback.
To display a specified output action to the right side of the output card, define a Spacer
element before the action.
@(Html.Kendo().AIPrompt()
.Name("aiprompt")
.OutputActions(action =>
{
action.Copy();
action.Retry();
action.Custom().Type(ItemType.Spacer);
action.Rating();
})
)
Custom Actions
Custom actions let you add domain-specific commands, such as Export, Translate, Summarize, and more.
The custom output actions support the following appearance options:
Option | Description |
---|---|
Comamnd() | Defines the name of the action (a command identifier). |
Type() | Sets the command type (a Button or a Spacer ). |
Icon() | Specifies an icon for the button. |
FillMode() | Defines how the color is applied to the action button. |
Rounded() | Determines the border radius of the button. |
ThemeColor() | Sest what color will be applied to the button. |
Text() | Sets the button's text. |
Title() | Configures a title to the button's element (a tooltip). |
When a custom action is clicked, the AIPrompt triggers the OutputAction
client-side event. You can handle the event, identify the selected action, and implement the desired custom logic.
The example below shows how to define custom output actions and handle their click
events.
@(Html.Kendo().AIPrompt()
.Name("aiprompt")
.OutputActions(action =>
{
action.Custom().Icon("heart-outline").Command("like");
action.Custom().Text("Share").Icon("share").Command("share");
})
.Events(ev => ev.OutputAction("onOutputAction"))
)