dialogs

Use the dialogs service to display standard dialogs, e.g. a confirmation dialog.

Confirming a critical action

To confirm a critical action, use the confirm function of the notifications service:

<Button
  onClick={
    async (): Promise<void> => {
      const chosenAction = await dialogs.confirm({
        title: 'Do you really want to delete the item?',
        actions: {
          confirm: 'Delete item!',
          cancel: 'Cancel'
        }
      });

      notifications.show({ type: 'success', text: `You chose ${chosenAction}.` })
    }
  }
>
  Delete
</Button>