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://github.com/mnaoumov/obsidian-dev-utils/releases/latest/download/styles.css.
Import:
import { NumberComponent } from 'obsidian-dev-utils/obsidian/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.
Methods
| Method | Returns | Description |
|---|---|---|
| empty() | void | Empties the component. |
| isEmpty() | boolean | Checks if the component is empty. |
| setMax(max) | this | Sets the maximum value of the component. (Inherited from TypedRangeTextComponent) |
| setMin(min) | this | Sets the minimum value of the component. (Inherited from TypedRangeTextComponent) |
| setPlaceholder(placeholder) | this | Sets the placeholder of the component. |
| setPlaceholderValue(placeholderValue) | this | Sets the placeholder value of the component. |
| setPlaceholderValue(placeholderValue) | this | Sets the placeholder value of the component. (Inherited from TextBasedComponent) |
| setStep(step) | this | Sets the step value of the component. (Inherited from TypedRangeTextComponent) |
| valueFromString(str) | number | Converts a string to a number. |
Links to this page: