Skip to content

MultipleDropdownComponent

A multi-select dropdown component.

You can add this component using SettingEx.addMultipleDropdown.

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 { MultipleDropdownComponent } from 'obsidian-dev-utils/obsidian/setting-components/multiple-dropdown-component';

Signature:

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

Extends: ValueComponent<readonly string[]>

Implements: ValidatorComponent, ValueComponentWithChangeTracking<readonly string[]>

Constructor

new MultipleDropdownComponent(containerEl: HTMLElement)

Creates a new multiple dropdown component.

Properties

PropertyTypeDescription
dropdownComponentDropdownComponentThe inner dropdown component.
validatorElValidatorElementA validator element of the component.
(Inherited from ValidatorComponent)

Methods

MethodReturnsDescription
addOption(value, display)thisAdds an option to the dropdown.
addOptions(options)thisAdds multiple options to the dropdown.
getValue()readonly string[]Gets the value of the component.
onChange(callback)thisSets the callback function to be called when the component is changed.
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.
setValue(value)thisSets the value of the component.
simulateChange__()voidSimulate a change event.

Links to this page: