Skip to content

AbstractTextComponent<T>

Official

Component for a text input or text area.

Import:

import { AbstractTextComponent } from 'obsidian';

Signature:

export class AbstractTextComponent<T extends HTMLInputElement | HTMLTextAreaElement> extends ValueComponent<string>

Extends: ValueComponent<string>

Constructor

new AbstractTextComponent(inputEl: T)

Constructor.

To get the constructor instance, use getAbstractTextComponentConstructor from obsidian-typings/implementations.

Properties

PropertyTypeDescription
inputElTThe input element.

Methods

MethodReturnsDescription
changeCallback(value)voidThe function that's called after changing the value of the component.
getValue()stringGets the value of the input element.
onChange(callback)thisSets the callback to handle when the value of the input element changes.
onChanged()voidManually invokes the callback registered with onChange.
registerOptionListener(listeners, key)thisRegister an option listener.
(Inherited from ValueComponent)
setDisabled(disabled)thisSets the disabled state of the input element.
setPlaceholder(placeholder)thisSets the placeholder of the input element.
setValue(value)thisSets the value of the input element.
setValue(value)thisSet the value of the component.
(Inherited from ValueComponent)

Links to this page: