SliderComponent
Official
A slider component.
Import:
import { SliderComponent } from 'obsidian';Signature:
export class SliderComponent extends ValueComponent<number>Extends: ValueComponent<number>
Constructor
new SliderComponent(containerEl: HTMLElement)Constructor.
To get the constructor instance, use getSliderComponentConstructor from obsidian-typings/implementations.
Properties
| Property | Type | Description | |
|---|---|---|---|
| sliderEl | HTMLInputElement | The HTML element that represents the slider. |
Methods
| Method | Returns | Description | |
|---|---|---|---|
| changeCallback(value) | void | The function that's called after changing the value of the component. | |
| getValue() | number | Get the value of the slider. | |
| getValuePretty() | string | Get the pretty value of the slider. | |
| onChange(callback) | this | Set the callback to be called when the slider value changes. | |
| registerOptionListener(listeners, key) | this | Register an option listener. (Inherited from ValueComponent) | |
| setDisabled(disabled) | this | Disable the slider. | |
| setDisplayFormat(format) | this | Set a custom formatter for the value shown inline next to the slider. | |
| setDynamicTooltip() | this | Set the dynamic tooltip of the slider. | |
| setInstant(instant) | this | Set whether or not the value should get updated while the slider is dragging. | |
| setLimits(min, max, step) | this | Set the limits of the slider. | |
| setValue(value) | this | Set the value of the slider. | |
| setValue(value) | this | Set the value of the component. (Inherited from ValueComponent) | |
| showTooltip() | void | Shows the slider's value tooltip. | |
| updateDisplay() | void | Updates the displayed value text of the slider. |
Links to this page: