TypedMultipleDropdownComponent<T>
A multi-select dropdown component.
You can add this component using SettingEx.addTypedMultipleDropdown.
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 { TypedMultipleDropdownComponent } from 'obsidian-dev-utils/obsidian/setting-components/typed-multiple-dropdown-component';Signature:
export class TypedMultipleDropdownComponent<T> extends ValueComponent<readonly T[]> implements ValidatorComponent, ValueComponentWithChangeTracking<readonly T[]>Extends: ValueComponent<readonly T[]>
Implements: ValidatorComponent, ValueComponentWithChangeTracking<readonly T[]>
Constructor
new TypedMultipleDropdownComponent(containerEl: HTMLElement)Creates a new multiple dropdown component.
Properties
| Property | Type | Description |
|---|---|---|
| multipleDropdownComponent | MultipleDropdownComponent | The inner multiple dropdown component. |
| validatorEl | ValidatorElement | A validator element of the component. (Inherited from ValidatorComponent) |
| values | T[] | The list of selectable option values, indexed by their position in the dropdown. |
Methods
| Method | Returns | Description |
|---|---|---|
| addOption(value, display) | this | Adds an option to the dropdown. |
| addOptions(options) | this | Adds multiple options to the dropdown. |
| getValue() | readonly T[] | Gets the value of the component. |
| onChange(callback) | this | Sets the callback function to be called when the component is changed. |
| 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. |
| setValue(value) | this | Sets the value of the component. |
| simulateChange__() | void | Simulate a change event. |
Links to this page: