# SmartTextBoxAdapter

## Overview

The **SmartTextBoxAdapter** enhances the Wisej.Web.TextBox control, incorporating artificial intelligence capabilities. As an [IExtenderProvider](https://learn.microsoft.com/en-us/dotnet/api/system.componentmodel.iextenderprovider) component, once it is placed onto a design surface, it automatically augments all TextBox controls within the designer with additional AI-specific properties.

## Configuration

```csharp
[Extends(typeof(TextBox), allowMultiple: true)]
```

## Properties

In addition to the properties inherited from the [SmartAdapter](/ai/components/adapters/smartadapter.md), the SmartTextBoxAdapter exposes the following additional properties.

### SuggestionDelay

This parameter specifies the delay, measured in milliseconds, before suggestions are displayed. It controls how soon the suggestions appear after the user pauses typing after pressing the space bar.

{% hint style="warning" %}
Suggestions are generated when the user types a space character. This approach ensures that the system sends more complete input to the AI model, avoiding the transmission of incomplete or partial text.
{% endhint %}

### AcceptIconSource

The **AcceptIconSource** property specifies the icon that appears next to the suggested text. By default, this icon is represented by a small ![](/files/Z9FrCxXAaDnW91EyfRaG) icon, which provides a visual cue to the user. On mobile devices, tapping this icon allows users to accept the suggestion seamlessly.

Wisej.AI offers two accept icons: "tab-icon-dark.png" and "tab-icon-light.png." These icons can be used as themed icons under the names "tab-icon-dark" and "tab-icon-light," or accessed as embedded resources within the Wisej.AI assembly. The default setting uses "resource.wx/Wisej.AI/Icons/tab-icon-dark.png."

### ProcessingIconSource

The ProcessingIconSource property specifies an icon that appears at the bottom right corner of the TextBox while the AI model is processing a request. By default, this is set to "resource.wx/Wisej.AI/Icons/processing.svg," which features an animated icon to visually indicate activity. <img src="/files/X22uc1qaord5pDG9TZ5F" alt="" data-size="line">

### SuggestionStyle

The CSS style applied to the suggested text defines its appearance once it is appended after the cursor. By default, this style is set to "opacity: 0.4," giving the text a lighter color to distinguish it from the regular input text.

## Extender Properties

### EnableSuggestions

This property determines whether the suggestions feature is activated for a specific control. When enabled, Wisej.AI attempts to predict and suggest the next piece of text based on the values provided in the **UserRole** and **UserPhrases** properties.

#### UserRole

The **UserRole** property informs the AI model of the "role" it should emulate when generating suggestions. This contextual guidance allows the AI to tailor its suggestions according to the specified role, such as "Account Manager" or "Tech Support Specialist."

#### UserPhrases

The **UserPhrases** property consists of a list of suggested completion lines for text. These phrases serve as contextual information for the AI model, guiding it on how to complete the user's sentences effectively.&#x20;

This property can be used to define guidelines and potential answer templates, helping to shape more relevant and context-aware suggestions. For example, phrases like "Next service due at \_\_\_" and "Could you please post a screenshot of the issue" can be included to tailor the AI's responses.

### EnableTranslation

This feature enables automatic translation of text within the TextBox. When the **AutoRun** property is set to `true`, the translation process is triggered whenever the TextBox.Text property changes.

With this setting enabled, Wisej.AI utilizes the **TranslateFromLanguage** and **TranslateToLanguage** properties to inform the AI model of the original language and the desired target language, facilitating seamless translation.

#### TranslateFromLanguage

This property holds a string that specifies the language of the original text. Acceptable values include language codes like "de," language names such as "German," or other identifiers like "en." Any value that the AI model can interpret for translation is suitable for this property.

#### TranslateToLanguage

This property holds a string that specifies the language of the target translated text. Acceptable values include language codes like "de," language names such as "German," or other identifiers like "en." Any value that the AI model can interpret for translation is suitable for this property.

### EnableAutoCorrection

This feature offers automatic correction of text within the TextBox. When enabled, Wisej.AI autonomously rectifies any typographical errors in the text entered by the user, ensuring that the original meaning is preserved. Note that this feature focuses solely on correcting errors and does not involve translating the text.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.wisej.com/ai/components/adapters/smarttextboxadapter.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
