Skip to content

Prompt

This function displays a prompt with the specified properties and waits for the input to be entered before resolving the promise.

Prompt

Before this page can be accessed, we need your full name.

Requires FluxRoot

Prompts render through a parent <FluxRoot>. Without one in your app, nothing appears and no error is thrown.

Required icons

circle-check

Functional API

Prompts can only be shown from code. An Overlay should be used if you want to show a prompt from within your template.

⌛️ Waiting for prompt...

ts
const result = await showPrompt({
    icon: 'circle-exclamation',
    title: 'Title',
    message: 'What is your name?',
    fieldLabel: "Name"
});
ts
declare function showPrompt(spec: FluxPromptObject): Promise<void>;
ts
type FluxPromptObject = {
    readonly id: number;
    readonly icon?: FluxIconName;
    readonly message: string;
    readonly title: string;
    readonly fieldLabel: string;
    readonly fieldPlaceholder?: string;
    readonly fieldType?: InputType;

    onCancel(): void;
    onConfirm(text: string): void;
};

Used components