RadzenSmartPasteButton<TModel> Class

A button that fills a form model from the text in the clipboard with the help of an AI model. Reads the clipboard, asks the IChatClient configured for IAIChatService to extract the public properties of TModel from it and assigns the values. Put it inside a RadzenTemplateForm<T> bound to the same model.

Inheritance

Object

ComponentBase

RadzenComponent

RadzenSmartPasteButton<TModel>

Implements

IComponent

IHandleEvent

IHandleAfterRender

Namespace: Radzen.Blazor

Assembly: Radzen.Blazor.dll

Syntax

public class RadzenSmartPasteButton<TModel> : RadzenComponent, IComponent, IHandleEvent, IHandleAfterRender

Type Parameters

Name Description
TModelThe type of the form model.

Examples

<RadzenTemplateForm Data="@customer">
    <RadzenSmartPasteButton Data="@customer" Pasted="@(c => StateHasChanged())" />
    ...
</RadzenTemplateForm>

Constructors

RadzenSmartPasteButton<TModel>Link to this section

A button that fills a form model from the text in the clipboard with the help of an AI model. Reads the clipboard, asks the IChatClient configured for IAIChatService to extract the public properties of TModel from it and assigns the values. Put it inside a RadzenTemplateForm<T> bound to the same model.

Declaration
public RadzenSmartPasteButton<TModel>()

Properties

BusyTextLink to this section

Gets or sets the text shown while the model is working.

Declaration
public string BusyText { get; set; }
Property Value
Type Description
stringGets or sets the text shown while the model is working.

ButtonStyleLink to this section

Gets or sets the button style.

Declaration
public ButtonStyle ButtonStyle { get; set; }
Property Value
Type Description
ButtonStyleGets or sets the button style.

DataLink to this section

Gets or sets the model to fill. Required.

Declaration
public TModel Data { get; set; }
Property Value
Type Description
TModelGets or sets the model to fill. Required.

DisabledLink to this section

Gets or sets whether the button is disabled.

Declaration
public bool Disabled { get; set; }
Property Value
Type Description
boolGets or sets whether the button is disabled.

EmptyClipboardLink to this section

Event callback that is invoked when the clipboard is empty or cannot be read.

Declaration
public EventCallback EmptyClipboard { get; set; }
Property Value
Type Description
EventCallbackEvent callback that is invoked when the clipboard is empty or cannot be read.

ErrorLink to this section

Event callback that is invoked when the model request fails.

Declaration
public EventCallback<Exception> Error { get; set; }
Property Value
Type Description
EventCallback<Exception>Event callback that is invoked when the model request fails.

FieldsLink to this section

Gets or sets the names of the properties to fill. All public writable properties of simple types are filled when not set.

Declaration
public IEnumerable<string> Fields { get; set; }
Property Value
Type Description
IEnumerable<string>Gets or sets the names of the properties to fill. All public writable properties of simple types are filled when not set.

IconLink to this section

Gets or sets the icon. Default is content_paste_go.

Declaration
public string Icon { get; set; }
Property Value
Type Description
stringGets or sets the icon. Default is content_paste_go.

IconColorLink to this section

Gets or sets the icon color.

Declaration
public string IconColor { get; set; }
Property Value
Type Description
stringGets or sets the icon color.

InstructionsLink to this section

Gets or sets additional instructions for the model, for example the expected language or format of a field.

Declaration
public string Instructions { get; set; }
Property Value
Type Description
stringGets or sets additional instructions for the model, for example the expected language or format of a field.

IsBusyLink to this section

Gets whether a paste is in progress.

Declaration
public bool IsBusy { get; }
Property Value
Type Description
boolGets whether a paste is in progress.

ModelIdLink to this section

Gets or sets the model name. Falls back to the configured Model.

Declaration
public string ModelId { get; set; }
Property Value
Type Description
stringGets or sets the model name. Falls back to the configured Model.

PastedLink to this section

Event callback that is invoked after the model is filled. Receives Data.

Declaration
public EventCallback<TModel> Pasted { get; set; }
Property Value
Type Description
EventCallback<TModel>Event callback that is invoked after the model is filled. Receives Data.

ShadeLink to this section

Gets or sets the button shade.

Declaration
public Shade Shade { get; set; }
Property Value
Type Description
ShadeGets or sets the button shade.

SizeLink to this section

Gets or sets the button size.

Declaration
public ButtonSize Size { get; set; }
Property Value
Type Description
ButtonSizeGets or sets the button size.

TextLink to this section

Gets or sets the button text. Default is Smart paste.

Declaration
public string Text { get; set; }
Property Value
Type Description
stringGets or sets the button text. Default is Smart paste.

TitleLink to this section

Gets or sets the button title (tooltip).

Declaration
public string Title { get; set; }
Property Value
Type Description
stringGets or sets the button title (tooltip).

VariantLink to this section

Gets or sets the button variant.

Declaration
public Variant Variant { get; set; }
Property Value
Type Description
VariantGets or sets the button variant.

Methods

BuildRenderTreeLink to this section

Declaration
protected override void BuildRenderTree(Rendering.RenderTreeBuilder __builder)
Parameters
Type Name Description
Rendering.RenderTreeBuilder __builder

GetComponentCssClassLink to this section

Declaration
protected override string GetComponentCssClass()
Returns
Type Description
string

PasteLink to this section

Fills Data from the specified text instead of the clipboard.

Declaration
public Task Paste(string text)
Parameters
Type Name Description
string text The text to extract the field values from.
Returns
Type Description
Task
An error has occurred. This app may no longer respond until reloaded. Reload 🗙