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
| Property | Type | Description |
|---|---|---|
| empty | () => void | Empties the component. (Inherited from TextBasedComponent) |
| isEmpty | () => boolean | Checks if the component is empty. (Inherited from TextBasedComponent) |
| onChange | (callback: (newValue: readonly string[]) => void) => this | Sets a callback function to be called when the value of the component changes. (Inherited from ValueComponentWithChangeTracking) |
| setPlaceholderValue | (placeholderValue: readonly string[]) => this | Sets the placeholder value of the component. (Inherited from TextBasedComponent) |
| 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. |
| setDisabled(isDisabled) | 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. |
| 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: