Skip to content

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';
You want to…UseReference
Ask the user to confirm or cancel an action and await the button they choseConfirmationDialog, triggered with useConfirmationDialogConfirmationDialog
Block the screen with a spinner while a long-running operation completesBusyIndicatorDialog, shown with useBusyIndicatorBusyIndicatorDialog
Show your own content, collect values, and return a typed result to the callerDialog with useDialog / useDialogContextDialog
Show a detail pane against the side of the viewportDialog 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, or StepperCommandDialog for several steps. They validate and execute the command and manage the footer state for you.
  • The input belongs on the page. Use CommandForm or 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.