usePrompt
This hook can be used to prompt the user for confirmation of an action.
Usage
import { usePrompt } from "@medusajs/ui"
1const dialog = usePrompt()2const actionFunction = async () => {3 const confirmed = await dialog({4 title: "Are you sure?",5 description: "Please confirm this action",6 })7}
API Reference
Call Signature
usePrompt()
usePrompt return
Value | Type | Description |
---|---|---|
dialog | function | Async function used to display a new confirmation dialog. |
Was this section helpful?
PromptProps
Value | Type | Description |
---|---|---|
title | string | |
description | string | |
verificationText | string | Text the user has to input in order to confirm the action |
cancelText | string | Label for the Cancel button. Defaults to "Cancel". |
confirmText | string | Label for the Confirm button. Defaults to "Confirm". |
Was this section helpful?
Examples
Basic
Was this example helpful?
With Verification
Was this example helpful?