Prompt

A component that displays a dialog prompting the user for their approval. It's useful when confirming destructive actions.

Note: 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.

In this guide, you'll learn how to use the Prompt component.

Was this example helpful?

Usage#

Code
import { Prompt } from "@medusajs/ui"
Code
1<Prompt>2  <Prompt.Trigger>Trigger</Prompt.Trigger>3  <Prompt.Content>4    <Prompt.Header>5      <Prompt.Title>Title</Prompt.Title>6      <Prompt.Description>Description</Prompt.Description>7    </Prompt.Header>8    <Prompt.Footer>9      <Prompt.Cancel>Cancel</Prompt.Cancel>10      <Prompt.Action>Delete</Prompt.Action>11    </Prompt.Footer>12  </Prompt.Content>13</Prompt>

API Reference#

Prompt#

This component is based on the Radix UI Alert Dialog primitives.

PropTypeDefault
variant
"danger"
|"confirmation"
"danger"
Was this helpful?

Prompt.Header#

This component is based on the div element and supports all of its props

Prompt.Footer#

This component is based on the div element and supports all of its props


Examples#

Confirmation Prompt Variant#

The confirmation variant is useful when confirming an operation that isn't destructive, such as deleting an item.

Was this guide helpful?
Ask Anything
Ask any questions about Medusa. Get help with your development.
You can also use the Medusa MCP server in Cursor, VSCode, etc...
FAQ
What is Medusa?
How can I create a module?
How can I create a data model?
How do I create a workflow?
How can I extend a data model in the Product Module?
Recipes
How do I build a marketplace with Medusa?
How do I build digital products with Medusa?
How do I build subscription-based purchases with Medusa?
What other recipes are available in the Medusa documentation?
Chat is cleared on refresh
Line break