Skip to content

PromptParams

Options for prompt.

Import:

import type { PromptParams } from '@mnaoumov/obsidian-lib/modals/prompt';

Signature:

export interface PromptParams extends ModalParamsBase

Extends: ModalParamsBase

Properties

PropertyTypeDescription
appAppAn Obsidian app instance.
(Inherited from ModalParamsBase)
cancelButtonText?stringA text for the "Cancel" button.
commandBuilder?ModalCommandBuilderExtra controls — checkboxes, dropdowns and keyboard shortcuts — rendered as a strip along the bottom of the modal, so a caller gets a text input plus options with no bespoke modal of its own.

Hand it a configured ModalCommandBuilder; the modal builds it. The strip is rendered after the buttons, so it sits along the bottom edge where a SuggestModal's instruction bar sits.
commandsRenderMode?ModalCommandsRenderModeThe way PromptParams.commandBuilder's controls are rendered.
cssClasses?string[]A CSS class to apply to the modal.
(Inherited from ModalParamsBase)
defaultValue?stringA default value to pre-fill the input field.
isMasked?booleanWhether the input masks what is typed, for a password, an API key or another secret.

A masked input is a password input with autocomplete turned off and spell-checking always off (PromptParams.spellcheckMode is ignored), so the value is never sent to a spell-checking service. A toggle button beside it shows and hides the value, so the user can check what was typed.
okButtonText?stringA text for the "OK" button.
placeholder?stringA placeholder text for the input field.
spellcheckMode?SpellcheckModeThe mode deciding whether the input is spell-checked.

The default is what this modal has always done, so passing nothing changes nothing: the input follows Editor > Spellcheck, like Obsidian's own name-entry surfaces. Pass SpellcheckMode.Off for a box that is really a search field, or SpellcheckMode.AlwaysOn to spell-check it whatever the vault setting says.
title?DocumentFragment | stringA title of the modal.
valueValidator?(value: string) => Promisable<MaybeReturn<null | string>>A function to validate the input value.

Links to this page: