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
| Property | Type | Description |
|---|---|---|
| textAreaComponent | TextAreaComponent | The inner text area component. |
| validatorEl | ValidatorElement | A validator element of the component. (Inherited from ValidatorComponent) |
Methods
| Method | Returns | Description |
|---|---|---|
| empty() | void | Empties the component. |
| getValue() | readonly string[] | Gets the value of the component. |
| isEmpty() | boolean | Checks if the component is empty. |
| onChange(callback) | this | Adds a change listener to the component. |
| onChange(callback) | this | Sets a callback function to be called when the value of the component changes. (Inherited from ValueComponentWithChangeTracking) |
| setDisabled(disabled) | this | Sets the disabled state of the component. |
| setPlaceholder(placeholder) | this | Sets the placeholder of the component. |
| setPlaceholderValue(placeholderValue) | this | Sets the placeholder value of the component. |
| setPlaceholderValue(placeholderValue) | this | Sets the placeholder value of the component. (Inherited from TextBasedComponent) |
| setValue(value) | this | Sets the value of the component. |
| simulateChange__() | void | Simulate a change event. |
| valueToString(value) | string | Converts the value to the string shown in the text area. Subclasses can override to customize the serialization. |
Links to this page: