Dialogs
The Dialogs subpath covers modal interruptions that do not run a command. Import from @cratis/components/Dialogs:
import { BusyIndicatorDialog, ConfirmationDialog, Dialog } from '@cratis/components/Dialogs';Which dialog to use
Section titled “Which dialog to use”| You want to… | Use | Reference |
|---|---|---|
| Ask the user to confirm or cancel an action and await the button they chose | ConfirmationDialog, triggered with useConfirmationDialog | ConfirmationDialog |
| Block the screen with a spinner while a long-running operation completes | BusyIndicatorDialog, shown with useBusyIndicator | BusyIndicatorDialog |
| Show your own content, collect values, and return a typed result to the caller | Dialog with useDialog / useDialogContext | Dialog |
| Show a detail pane against the side of the viewport | Dialog with placement='start' or 'end' | Dialog placement |
ConfirmationDialog and BusyIndicatorDialog are rendered by the Arc dialog host: register them once with DialogComponents and trigger them through the hooks from @cratis/arc.react/dialogs. ConfirmationDialog takes its title, message, and buttons from the request, and BusyIndicatorDialog takes its title and message, so reach for Dialog as soon as you need content of your own.
When not to use a dialog from this subpath
Section titled “When not to use a dialog from this subpath”- Confirming runs an Arc command. Use
CommandDialog, orStepperCommandDialogfor several steps. They validate and execute the command and manage the footer state for you. - The input belongs on the page. Use
CommandFormor the controls in Common instead of a modal. - The message is transient and needs no answer. Use a toast from Notifications.
For the wider decision across subpaths, see Choosing a component.