Is there a separate component for entering Numbers or should I just use TextComponent and check the returned value?
You can create an input and sets it’s type to number
new Setting(this.containerEl)
.setName("Words per dot")
.setDesc("How many words should be represented by a single dot?")
.addText((textfield) => {
textfield.setPlaceholder(String(DEFAULT_WORDS_PER_DOT));
textfield.inputEl.type = "number";
textfield.setValue(String(this.plugin.options.wordsPerDot));
textfield.onChange(async (value) => {
this.plugin.writeOptions(() => ({
wordsPerDot: value !== "" ? Number(value) : undefined,
}));
});
});
That is an extract from fantasy calendar
1 Like