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://github.com/mnaoumov/obsidian-dev-utils/releases/latest/download/styles.css.

Import:

import { MultipleTextComponent } from 'obsidian-dev-utils/obsidian/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
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.
onChange(callback)thisSets a callback function to be called when the value of the component changes.
(Inherited from ValueComponentWithChangeTracking)
setDisabled(disabled)thisSets the disabled state of the component.
setPlaceholder(placeholder)thisSets the placeholder of the component.
setPlaceholderValue(placeholderValue)thisSets the placeholder value of the component.
setPlaceholderValue(placeholderValue)thisSets the placeholder value of the component.
(Inherited from TextBasedComponent)
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: