Dialog

Description

A modal dialog component using native HTML dialog element.

Usage

bc_dialog(
  id,
  title = NULL,
  description = NULL,
  content = NULL,
  actions = NULL,
  ...,
  open = FALSE,
  close_on_click = TRUE
)

bc_dialog_close(label = "Close", ..., variant = "primary")

Arguments

Argument Description
id String. The dialog's unique ID.
title String or tag. The dialog title.
description String or tag. The dialog description.
content Function or tag. The main dialog content.
actions Function or tag. Action buttons for the dialog.
... Additional attributes passed to the <dialog>.
open Bool. Whether the dialog is initially open.
close_on_click Bool. Whether to close the dialog when clicking outside.
label String or tag. The button's label.
variant String. The button variant, as in bc_button().

Value

A dialog element with proper structure and behavior.

Examples

bc_dialog_trigger("profile-dialog", class = "btn", "Edit profile")

bc_dialog(
  id = "profile-dialog",
  title = "Edit profile",
  description = "Make changes to your profile here.",
  content = bc_input(id = "name", label = "Name", value = "Pedro Duarte"),
  actions = htmltools::tagList(
    bc_dialog_close("Cancel", variant = "outline"),
    bc_dialog_close("Save changes")
  )
)

Edit profile

Make changes to your profile here.


bc_dialog_close("Cancel", variant = "outline")