Skip to content

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 ListComponent

Extends: ListComponent

Constructor

new FolderListComponent(containerEl: HTMLElement, app: App)

Creates a new folder list component.

Properties

PropertyTypeDescription
listElHTMLElementThe element holding one row per item.
(Inherited from ListComponent)
newItemButtonExtraButtonComponentThe button that adds the typed item.
(Inherited from ListComponent)
newItemInputElHTMLInputElementThe input the next item is typed into.
(Inherited from ListComponent)
onChange(callback: (newValue: readonly string[]) => void) => thisSets a callback function to be called when the value of the component changes.
(Inherited from ListComponent)
suggestFolderInputSuggestThe folder suggest attached to ListComponent.newItemInputEl.

Methods

MethodReturnsDescription
addTypedItem()booleanAdds 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)stringFormats an item for display.
(Inherited from ListComponent)
getValue()readonly string[]Gets the items.
(Inherited from ListComponent)
normalizeItem(text)null | stringNormalizes a typed folder path.
onChange(callback)thisSets the callback to be called when the user adds, moves or removes an item.
(Inherited from ListComponent)
setDisabled(isDisabled)thisSets the disabled state of the component.
(Inherited from ListComponent)
setPlaceholder(placeholder)thisSets the placeholder of ListComponent.newItemInputEl.
(Inherited from ListComponent)
setValue(value)thisSets the items.
(Inherited from ListComponent)

Links to this page: