Skip to content

TypedTextComponent<T>

A component that displays and edits a text-based value.

Import:

import { TypedTextComponent } from '@mnaoumov/obsidian-lib/setting-components/typed-text-component';

Signature:

export class TypedTextComponent<T> extends ValueComponent<T> implements ValidatorComponent, ValueComponentWithChangeTracking<T>

Extends: ValueComponent<T>

Implements: ValidatorComponent, ValueComponentWithChangeTracking<T>

Constructor

new TypedTextComponent(params: TypedTextComponentConstructorParams)

Creates a new typed text component.

Properties

PropertyTypeDescription
inputElHTMLInputElementAn input element of the component.
onChange(callback: (newValue: T) => void) => thisSets a callback function to be called when the value of the component changes.
(Inherited from ValueComponentWithChangeTracking)
textComponentTextComponentThe inner text component.
validatorElValidatorElementA validator element of the component.
(Inherited from ValidatorComponent)

Methods

MethodReturnsDescription
getValue()TGets the value of the component.
onChange(callback)thisSets the callback function to be called when the component is changed.
onChanged()voidCalled when the component is changed.
setDisabled(isDisabled)thisSets the disabled state of the component.
setValue(value)thisSets the value of the component.
valueFromString($string)TConverts a string to a value.
valueToString(value)stringConverts a value to a string.

Links to this page: