Skip to content

MultipleTextComponent

A component that displays and edits multiple text values.

You can add this component using SettingEx.addMultipleText.

In order to add the styles for the component, use initPluginContext in your plugin’s onload() function.

Alternatively, you can copy styles from https://unpkg.com/@mnaoumov/obsidian-lib/dist/styles.css.

Import:

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

Signature:

export class MultipleTextComponent extends ValueComponent<readonly string[]> implements TextBasedComponent<readonly string[]>, ValidatorComponent, ValueComponentWithChangeTracking<readonly string[]>

Extends: ValueComponent<readonly string[]>

Implements: TextBasedComponent<readonly string[]>, ValidatorComponent, ValueComponentWithChangeTracking<readonly string[]>

Constructor

new MultipleTextComponent(containerEl: HTMLElement)

Creates a new multiple text component.

Properties

PropertyTypeDescription
empty() => voidEmpties the component.
(Inherited from TextBasedComponent)
isEmpty() => booleanChecks if the component is empty.
(Inherited from TextBasedComponent)
onChange(callback: (newValue: readonly string[]) => void) => thisSets a callback function to be called when the value of the component changes.
(Inherited from ValueComponentWithChangeTracking)
setPlaceholderValue(placeholderValue: readonly string[]) => thisSets the placeholder value of the component.
(Inherited from TextBasedComponent)
textAreaComponentTextAreaComponentThe inner text area component.
validatorElValidatorElementA validator element of the component.
(Inherited from ValidatorComponent)

Methods

MethodReturnsDescription
empty()voidEmpties the component.
getValue()readonly string[]Gets the value of the component.
isEmpty()booleanChecks if the component is empty.
onChange(callback)thisAdds a change listener to the component.
setDisabled(isDisabled)thisSets the disabled state of the component.
setPlaceholder(placeholder)thisSets the placeholder of the component.
setPlaceholderValue(placeholderValue)thisSets the placeholder value of the component.
setValue(value)thisSets the value of the component.
simulateChange__()voidSimulate a change event.
valueToString(value)stringConverts the value to the string shown in the text area. Subclasses can override to customize the serialization.

Links to this page: