usePrompt
This hook returns a function that prompts the user to confirm an action.
In this guide, you'll learn how to use the usePrompt
hook.
Was this example helpful?
Usage#
API Reference#
usePrompt Return Value#
Name | Type | Description |
---|---|---|
dialog | function | Async function used to display a new confirmation dialog. |
Was this guide helpful?
Returned Dialog Parameters#
The dialog function returned by usePrompt
accepts an object having the following properties:
Prop | Type | Default |
---|---|---|
title | string | - |
description | string | - |
variant | "danger" | "confirmation" | "danger" |
verificationText | string | - |
verificationInstruction | string | "Please type {val} to confirm:" |
cancelText | string | "Cancel" |
confirmText | string | "Confirm" |
Was this helpful?
Dialog Return Value#
The dialog function returns a Promise that resolves to a boolean indicating whether the user confirmed the action.
Examples#
Prompt with Verification Text#
Was this guide helpful?