1 ---
2 generate_toc: true
3 ---
4
5 import { ComponentExample } from "@/components/ComponentExample"
6 import { ComponentReference } from "@/components/ComponentReference"
7
8 export const metadata = {
9 title: `Prompt`,
10 }
11
12 # {metadata.title}
13
14 A component that displays a dialog prompting the user for their approval. It's useful when confirming destructive actions.
15
16 <Note>
17
18 This component is useful if you want to control the prompt's content, format, and design. For a simpler approach that follows Medusa's prompt format, refer to the [usePrompt hook](../../hooks/use-prompt/page.mdx).
19
20 </Note>
21
22 In this guide, you'll learn how to use the Prompt component.
23
24 <ComponentExample name="prompt-demo" />
25
26 ## Usage
27
28 ```tsx
29 import { Prompt } from "@medusajs/ui"
30 ```
31
32 ```tsx
33 <Prompt>
34 <Prompt.Trigger>Trigger</Prompt.Trigger>
35 <Prompt.Content>
36 <Prompt.Header>
37 <Prompt.Title>Title</Prompt.Title>
38 <Prompt.Description>Description</Prompt.Description>
39 </Prompt.Header>
40 <Prompt.Footer>
41 <Prompt.Cancel>Cancel</Prompt.Cancel>
42 <Prompt.Action>Delete</Prompt.Action>
43 </Prompt.Footer>
44 </Prompt.Content>
45 </Prompt>
46 ```
47
48 ---
49
50 ## API Reference
51
52 <ComponentReference mainComponent="Prompt" componentsToShow={[
53 "Prompt",
54 "Prompt.Header",
55 "Prompt.Footer"
56 ]} />
57
58 ---
59
60 ## Examples
61
62 ### Confirmation Prompt Variant
63
64 The `confirmation` variant is useful when confirming an operation that isn't destructive, such as deleting an item.
65
66 <ComponentExample name="prompt-confirmation" hideFeedback />