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
| Property | Type | Description |
|---|---|---|
| empty | () => void | Empties the component. (Inherited from TextBasedComponent) |
| isEmpty | () => boolean | Checks if the component is empty. (Inherited from TextBasedComponent) |
| setPlaceholderValue | (placeholderValue: number) => this | Sets the placeholder value of the component. (Inherited from TextBasedComponent) |
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. |
| setStep(step) | this | Sets the step value of the component. (Inherited from TypedRangeTextComponent) |
| valueFromString($string) | number | Converts a string to a number. |
Links to this page: