Prompt Dialog

A dialog that asks for a single value, with async submit and inline errors.

v0

Installation

Full Setup guide

Install the component automatically via Shadcn CLI.

npx shadcn@latest add https://www.grettech.com/api/registry/prompt-dialog

Other Examples

Destructive Action

v0

Props

PropTypeDefaultDescription
title
string"Enter Value"Dialog title, also used as the input's accessible label.
description
string"Please provide the requested information below."Text under the title. Pass an empty string to hide it.
placeholder
string"Enter value..."Placeholder of the input.
submitText
string"Submit"Label of the submit button.
onConfirm
(value: string) => void | Promise<void>() => {}Called with the trimmed value on submit. While a returned promise is pending the dialog shows a loading state; if it throws, the error message is shown and the dialog stays open.
children
React.ReactNode<Button variant="outline">Open Prompt</Button>Trigger element. It receives onClick, so pass a button or a component that forwards onClick. Plain text is wrapped in an outline Button.
size
"default" | "sm" | "lg""default"Maximum width of the dialog.
className
string-Extra classes for the dialog content.
...props
React.HTMLAttributes<HTMLDivElement>-Any other attributes (id, style, aria-*, etc.), passed to the dialog content.