Skip to content

NumberComponent

A component that displays and edits a number.

You can add this component using SettingEx.addNumber.

In order to add the styles for the component, use initPluginContext in your plugin’s onload() function.

Alternatively, you can copy styles from https://unpkg.com/@mnaoumov/obsidian-lib/dist/styles.css.

Import:

import { NumberComponent } from '@mnaoumov/obsidian-lib/setting-components/number-component';

Signature:

export class NumberComponent extends TypedRangeTextComponent<number> implements TextBasedComponent<number>

Extends: TypedRangeTextComponent<number>

Implements: TextBasedComponent<number>

Constructor

new NumberComponent(containerEl: HTMLElement)

Creates a new number component.

Properties

PropertyTypeDescription
empty() => voidEmpties the component.
(Inherited from TextBasedComponent)
isEmpty() => booleanChecks if the component is empty.
(Inherited from TextBasedComponent)
setPlaceholderValue(placeholderValue: number) => thisSets the placeholder value of the component.
(Inherited from TextBasedComponent)

Methods

MethodReturnsDescription
empty()voidEmpties the component.
isEmpty()booleanChecks if the component is empty.
setMax(max)thisSets the maximum value of the component.
(Inherited from TypedRangeTextComponent)
setMin(min)thisSets the minimum value of the component.
(Inherited from TypedRangeTextComponent)
setPlaceholder(placeholder)thisSets the placeholder of the component.
setPlaceholderValue(placeholderValue)thisSets the placeholder value of the component.
setStep(step)thisSets the step value of the component.
(Inherited from TypedRangeTextComponent)
valueFromString($string)numberConverts a string to a number.

Links to this page: