Skip to content

SettingDefinitionList<K>

Official

A specialized SettingDefinitionGroup for collections of mutable data: entries the user adds, reorders, or removes. Rendered with a more compact visual style than a group, and supports emptyState, onReorder, and onDelete for the mutation affordances.

Import:

import type { SettingDefinitionList } from 'obsidian';

Signature:

export interface SettingDefinitionList<K extends string = string> extends SettingDefinitionGroup<K>

Extends: SettingDefinitionGroup<K>

Properties

Property Type Description
addItem? SettingDefinitionAddItem Add-entry affordance. The framework renders a platform-appropriate control: on desktop, a + button in the list header (with name as the tooltip); on mobile, a tappable + {name} row appended below the list.

The mobile row is not part of the indexed items: it does not appear in search, does not receive delete or reorder affordances, and is not counted by onDelete/onReorder indices.
cls? string CSS classes to add to the group element.
(Inherited from SettingDefinitionGroup)
emptyState? DocumentFragment | string Text to display when items is empty.
extraButtons? ((component: ExtraButtonComponent) => any)[] Extra button configuration for the header.
(Inherited from SettingDefinitionGroup)
heading? string Heading text displayed above the group.
(Inherited from SettingDefinitionGroup)
items? SettingGroupItem<K>[] Settings within this group.
(Inherited from SettingDefinitionGroup)
onDelete? (index: number) => void When set, adds a delete button to each item and enables Delete/Backspace keyboard shortcut. Called with the item index.
onReorder? (oldIndex: number, newIndex: number) => void When set, adds a drag handle to each item and enables drag-to-reorder. Called with old and new indices.
search? {
/**
* Placeholder text for the search input.
* @public
* @since 1.13.1
*/
placeholder?: string;
/**
* Predicate called for each direct child definition of this group.
* Return true to show the item, false to hide. Items with
* searchable: false bypass this filter and always show.
* @public
* @since 1.13.1
*/
match: (def: SettingDefinition, query: string) => boolean;
}
Adds a search input to the group header that filters the group's children by match(def, query). The query is preserved across re-renders and the filter is reapplied after each render.
(Inherited from SettingDefinitionGroup)
type 'list' Discriminant narrowing the parent's 'group' | 'list' to 'list'.
visible? (() => boolean) | boolean Controls whether the group is rendered. false or () => false hides it entirely (heading, controls, and items). Evaluated on each render.
(Inherited from SettingDefinitionGroup)

Links to this page: