Skip to main content

Home > blockly > Variables > promptName

Variables.promptName() function

Prompt the user for a new variable name.

Signature:

export declare function promptName(promptText: string, defaultText: string, callback: (p1: string | null) => void): void;

Parameters

ParameterTypeDescription
promptTextstringThe string of the prompt.
defaultTextstringThe default value to show in the prompt's field.
callback(p1: string | null) => voidA callback. It will be passed the new variable name, or null if the user picked something illegal.

Returns:

void