SettingSliderControl<K>
Official
A slider control bound to a numeric value.
Import:
import type { SettingSliderControl } from 'obsidian';Signature:
export interface SettingSliderControl<K extends string = string> extends SettingControlBase<number, K>Extends: SettingControlBase<number, K>
Properties
| Property | Type | Description | |
|---|---|---|---|
| defaultValue? | number | Fallback when the resolver returns undefined/null.(Inherited from SettingControlBase) | |
| disabled? | (() => boolean) | boolean | Disables the control. Evaluated on each render, so a function form can reflect runtime state (e.g. whether another plugin is installed). Call update() on the setting tab to re-evaluate after the underlying state changes.(Inherited from SettingControlBase) | |
| displayFormat? | (value: number) => string | Formats the value shown inline next to the slider. Return an empty string to hide the inline value entirely. | |
| key | K | The config/storage property name passed to getControlValue and setControlValue on the setting tab.(Inherited from SettingControlBase) | |
| max | number | Maximum permitted value. | |
| min | number | Minimum permitted value. | |
| step | number | Step granularity between adjacent values. | |
| type | 'slider' | Discriminant identifying this control as a slider. | |
| validate? | (value: number) => string | void | Promise<string | void> | Validate a candidate value before it is persisted. Return a non-empty string to reject the change and surface it as an inline error message below the setting; return void/empty/undefined to accept and persist. Primarily intended for text-bearing controls ( text, textarea, number, file, folder) where the user can enter values the bind's type alone can't constrain.The stored value may already be invalid when the setting is rendered (e.g. data from a previous version of your plugin). The framework runs validate once on mount and shows the message if the seeded value fails; it does not modify or replace the stored value. Plugins that need to enforce invariants on stored data should validate again when reading their settings.(Inherited from SettingControlBase) |