TextComponent
Official
A text component.
Import:
import { TextComponent } from 'obsidian';Signature:
export class TextComponent extends AbstractTextComponent<HTMLInputElement>Extends: AbstractTextComponent<HTMLInputElement>
Constructor
new TextComponent(containerEl: HTMLElement)Constructor.
To get the constructor instance, use getTextComponentConstructor from obsidian-typings/implementations.
Properties
| Property | Type | Description | |
|---|---|---|---|
| inputEl | HTMLInputElement | The input element. (Inherited from AbstractTextComponent) |
Methods
| Method | Returns | Description | |
|---|---|---|---|
| autoSelect(force?) | this | Selects the input's text when it receives focus. | |
| changeCallback(value) | void | The function that's called after changing the value of the component. (Inherited from AbstractTextComponent) | |
| getValue() | string | Gets the value of the input element. (Inherited from AbstractTextComponent) | |
| onChange(callback) | this | Sets the callback to handle when the value of the input element changes. (Inherited from AbstractTextComponent) | |
| onChanged() | void | Manually invokes the callback registered with onChange.(Inherited from AbstractTextComponent) | |
| registerOptionListener(listeners, key) | this | Register an option listener. (Inherited from AbstractTextComponent) | |
| setDisabled(disabled) | this | Sets the disabled state of the input element. (Inherited from AbstractTextComponent) | |
| setPlaceholder(placeholder) | this | Sets the placeholder of the input element. (Inherited from AbstractTextComponent) | |
| setValue(value) | this | Sets the value of the input element. (Inherited from AbstractTextComponent) |
Links to this page: