FolderListComponent
A ListComponent of vault folder paths: the add row suggests the vault’s folders, and a typed path is normalized with Obsidian’s normalizePath, so the root reads as /. A path need not exist yet.
You can add this component using SettingEx.addFolderList.
Import:
import { FolderListComponent } from '@mnaoumov/obsidian-lib/setting-components/folder-list-component';Signature:
export class FolderListComponent extends ListComponentExtends: ListComponent
Constructor
new FolderListComponent(containerEl: HTMLElement, app: App)Creates a new folder list component.
Properties
| Property | Type | Description |
|---|---|---|
| listEl | HTMLElement | The element holding one row per item. (Inherited from ListComponent) |
| newItemButton | ExtraButtonComponent | The button that adds the typed item. (Inherited from ListComponent) |
| newItemInputEl | HTMLInputElement | The input the next item is typed into. (Inherited from ListComponent) |
| onChange | (callback: (newValue: readonly string[]) => void) => this | Sets a callback function to be called when the value of the component changes. (Inherited from ListComponent) |
| suggest | FolderInputSuggest | The folder suggest attached to ListComponent.newItemInputEl. |
Methods
| Method | Returns | Description |
|---|---|---|
| addTypedItem() | boolean | Adds the text typed into ListComponent.newItemInputEl, when it normalizes to an item not yet in the list, and clears the input. (Inherited from ListComponent) |
| formatItem(item) | string | Formats an item for display. (Inherited from ListComponent) |
| getValue() | readonly string[] | Gets the items. (Inherited from ListComponent) |
| normalizeItem(text) | null | string | Normalizes a typed folder path. |
| onChange(callback) | this | Sets the callback to be called when the user adds, moves or removes an item. (Inherited from ListComponent) |
| setDisabled(isDisabled) | this | Sets the disabled state of the component. (Inherited from ListComponent) |
| setPlaceholder(placeholder) | this | Sets the placeholder of ListComponent.newItemInputEl. (Inherited from ListComponent) |
| setValue(value) | this | Sets the items. (Inherited from ListComponent) |
Links to this page: