Skip to content

Setting.addButton method

Setting › addButton

Official

Add a button to the setting.

Signature:

addButton(cb: (component: ButtonComponent) => unknown): this

Parameters:

Parameter Type Description
cb (component: ButtonComponent) => unknown The callback to add the button.

Returns: thisThe setting. To get the constructor instance, use getSettingConstructor from obsidian-typings/implementations.

Since: 0.9.7

Example:

setting.addButton((button) => {
button.setText('foo');
});