Skip to content

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

PropertyTypeDescription
inputElHTMLInputElementThe input element.
(Inherited from AbstractTextComponent)

Methods

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

Links to this page: