Alert Dialog

Description

A modal that interrupts the user and expects an explicit response, built on a native <dialog class="alert-dialog">.

Usage

bc_alert_dialog(
  ...,
  id = NULL,
  title = NULL,
  description = NULL,
  icon = NULL,
  cancel = "Cancel",
  confirm = "Continue",
  size = "default",
  open = FALSE,
  trigger = NULL
)

Arguments

Argument Description
... Attributes for the <dialog>.
id String. The dialog's id.
title String. The heading, wired via aria-labelledby.
description String or tag. Supporting text, wired via aria-describedby.
icon A tag. Content for a <figure> above the heading.
cancel String or list. The cancel action: a label, or a list with label and variant.
confirm String or list. The primary action, the same shape as cancel.
size String. default or sm. sm writes data-size="sm".
open Bool. Whether the dialog starts open.
trigger String. The trigger button's label, or NULL for no button.

Value

A <dialog> tag or, with a trigger, a tag list of a button and the dialog.

Details

Both actions close the dialog. NULL omits one.

Examples

bc_alert_dialog(
  title = "Are you absolutely sure?",
  description = "This cannot be undone.",
  trigger = "Show Dialog"
)

Are you absolutely sure?

This cannot be undone.


bc_alert_dialog(
  title = "Delete this chat?",
  description = "This cannot be undone.",
  confirm = list(label = "Delete", variant = "destructive"),
  trigger = "Delete Chat"
)

Delete this chat?

This cannot be undone.