AnnotatedTextEditor
Description
Annotated text editor
AnnotatedTextEditor is a multi-line editable text field that highlights NLP entities in place, like the OmniBox token rendering. A debounced async lambda (default 500ms) is called after the user stops typing and returns the entities found in the text.
Try editing the text below — entities are re-detected after you pause typing.
API reference
public class AnnotatedTextEditor : IComponent, IHasBackgroundColor, ITabIndexA multi-line text editor that supports inline annotations / highlights over user-entered prose.
- Namespace
- Tesserae
- Implements
- IComponent, IHasBackgroundColor, ITabIndex
Constructors
| Name | Description |
|---|---|
| AnnotatedTextEditor | Initializes a new instance of this class. |
Properties
| Name | Description |
|---|---|
| Text | Gets or sets the text shown in the component. |
| Entities | Gets or sets the entities. |
| Placeholder | Gets or sets the placeholder text shown when the component is empty. |
| Background | Gets or sets the CSS background of the component. |
| TabIndex | Sets the keyboard tab order of the component. |
| IsEnabled | Gets or sets a value indicating whether the component is interactive (enabled). |
| IsReadOnly | Returns a value indicating whether the component is read only. |
public string Text { get ; set ; }Gets or sets the text shown in the component.
public string Placeholder { get ; set ; }Gets or sets the placeholder text shown when the component is empty.
public string Background { get ; set ; }Gets or sets the CSS background of the component.
public int TabIndex { set ; }Sets the keyboard tab order of the component.
public bool IsEnabled { get ; set ; }Gets or sets a value indicating whether the component is interactive (enabled).
Methods
| Name | Description |
|---|---|
| SetText | Sets the text of the component. |
| SetPlaceholder | Sets the placeholder of the component. |
| Disabled | Disables the component. |
| ReadOnly | Configures the read only on the component. |
| OnTextChanged | Registers a callback invoked when the text changed event fires. |
| OnAnnotationsChanged | Registers a callback invoked when the annotations changed event fires. |
| OnEntityClick | Registers a callback invoked when the entity click event fires. |
| Height | Gets or sets the CSS height of the component. |
| H | Shortcut for setting the height in pixels. |
| MinHeight | Gets or sets the CSS min-height of the component. |
| Focus | Moves keyboard focus to the component. |
| Render | Renders the component's root HTML element. |
| TriggerAnnotate | Configures the trigger annotate on the component. |
public AnnotatedTextEditor SetText(string text)Sets the text of the component.
public AnnotatedTextEditor SetPlaceholder(string placeholder)Sets the placeholder of the component.
public AnnotatedTextEditor Disabled(bool value = true)Disables the component.
public AnnotatedTextEditor ReadOnly(bool value = true)Configures the read only on the component.
public AnnotatedTextEditor OnTextChanged(TextChangedHandler handler)Registers a callback invoked when the text changed event fires.
public AnnotatedTextEditor OnAnnotationsChanged(AnnotationsChangedHandler handler)Registers a callback invoked when the annotations changed event fires.
public AnnotatedTextEditor OnEntityClick(EntityClickHandler handler)Registers a callback invoked when the entity click event fires.
public AnnotatedTextEditor Height(UnitSize unitSize)Gets or sets the CSS height of the component.
public AnnotatedTextEditor H(int px)Shortcut for setting the height in pixels.
public AnnotatedTextEditor MinHeight(UnitSize unitSize)Gets or sets the CSS min-height of the component.
public AnnotatedTextEditor Focus()Moves keyboard focus to the component.
public HTMLElement Render()Renders the component's root HTML element.
Events
| Name | Description |
|---|---|
| AnnotationsChanged | Raised when annotations changed occurs. |
| TextChanged | Raised when text changed occurs. |
| EntityClicked | Raised when entity clicked occurs. |
public event AnnotationsChangedHandler AnnotationsChangedRaised when annotations changed occurs.
public event TextChangedHandler TextChangedRaised when text changed occurs.
Samples
Multi-line, editable, with entity highlighting
Read-only with clickable entities
Text cannot be edited, but entities still react to clicks.