SearchComponent
Official
A search component.
Import:
import { SearchComponent } from 'obsidian';Signature:
export class SearchComponent extends AbstractTextComponent<HTMLInputElement>Extends: AbstractTextComponent<HTMLInputElement>
Constructor
new SearchComponent(containerEl: HTMLElement)Constructor.
To get the constructor instance, use getSearchComponentConstructor from obsidian-typings/implementations.
Properties
| Property | Type | Description | |
|---|---|---|---|
| clearButtonEl | HTMLElement | The HTML element for the clear button. | |
| containerEl | HTMLElement | The containing element for the component's clearButtonEl and inputEl. | |
| inputEl | HTMLInputElement | The input element. (Inherited from AbstractTextComponent) |
Methods
| Method | Returns | Description | |
|---|---|---|---|
| addRightDecorator(decoratorFn) | this | Adds a decorator to the right side of the search component. | |
| autoSelect() | this | Selects the input's text when it receives focus. | |
| changeCallback(value) | void | The function that's called after changing the value of the component. (Inherited from AbstractTextComponent) | |
| getValue() | string | Gets the value of the input element. (Inherited from AbstractTextComponent) | |
| onChange(callback) | this | Sets the callback to handle when the value of the input element changes. (Inherited from AbstractTextComponent) | |
| onChanged() | void | Called when the search component's value changes. | |
| registerOptionListener(listeners, key) | this | Register an option listener. (Inherited from AbstractTextComponent) | |
| setClass(cls) | this | Adds a class to the search component. | |
| setDisabled(disabled) | this | Sets the disabled state of the input element. (Inherited from AbstractTextComponent) | |
| setPlaceholder(placeholder) | this | Sets the placeholder of the input element. (Inherited from AbstractTextComponent) | |
| setValue(value) | this | Sets the value of the input element. (Inherited from AbstractTextComponent) |
Links to this page: