mwg API
    Preparing search index...

    Interface TextPromptOptions

    interface TextPromptOptions {
        anchor?: "top" | "center" | "bottom";
        announce?: boolean;
        announcer?: Pick<ScreenReader, "announce">;
        blocker?: boolean;
        dims?: boolean;
        height: number;
        initialValue?: string;
        keyboard?: KeyboardLayout;
        maxLength?: number;
        message?: string;
        onCancel?: () => void;
        onConfirm: (value: string) => void;
        title?: string;
        validate?: (value: string) => string | null;
        width: number;
    }
    Index
    anchor?: "top" | "center" | "bottom"

    where the stack puts the prompt

    announce?: boolean

    Announce the message on open and a validation error on confirm through an a11y.ScreenReader. Default true; the calls are no-ops where there is no DOM.

    announcer?: Pick<ScreenReader, "announce">

    the reader announcements go to; the shared one by default, a fake in tests

    blocker?: boolean

    Whether a click under the prompt is swallowed rather than reaching the game behind it. On by default: a name not yet given is not something a stray click on the world should be able to act past.

    dims?: boolean

    dim the world behind; true for a modal window, which this is

    height: number
    initialValue?: string

    the field's starting text; the caret starts after it

    keyboard?: KeyboardLayout

    Rows of keys rendered beneath the field for pointer-only devices, feeding the same onText/onAction paths a physical key travels. Omit on a keyboard-first platform.

    maxLength?: number

    the most characters the field will hold; unlimited when omitted

    message?: string

    the one-line question above the field, announced politely on open

    onCancel?: () => void

    called on cancel, then the prompt closes; omit to just close

    onConfirm: (value: string) => void

    called with the value, then the prompt closes

    title?: string

    the window title; also announced by Window itself

    validate?: (value: string) => string | null

    Decides whether the current value may be confirmed: return an error message to keep the prompt open, or null (or '') when the value is fine. Runs only on confirm, so typing never nags; the error clears on the next edit.

    width: number