Learn R Programming

bsTools (version 0.1.0)

bs_modal: Create a Bootstrap modal

Description

Create a Bootstrap modal

Usage

bs_modal(
  id,
  title = h5("Note"),
  body,
  footer = button(type = "button", class = "btn btn-secondary", custom_attr =
    list(`data-bs-dismiss` = "modal"), "Close"),
  modal_class = "modal",
  dialog_class = "modal-dialog",
  content_class = "modal-content",
  header_class = "modal-header",
  title_class = "modal-title",
  body_class = "modal-body",
  footer_class = "modal-footer"
)

Arguments

id

A string, an id for the modal (to launch the modal, reference this id in the HTML element that will launch the modal. See example below).

title

A string, likely HTML, displayed as the title of the modal.

body

A string, likely HTML, displayed as the body of the modal.

footer

A string, likely HTML, displayed at the bottom of the modal.

modal_class

A string, the class added to the the div wrapping the dialog.

dialog_class

A string, the class added to the the div wrapping the content wrapper.

content_class

A string, the class added to the the div wrapping the content (header, body, footer).

header_class

A string, the class added to the the div wrapping the header.

title_class

A string, the class added to the the div wrapping the title.

body_class

A string, the class added to the div wrapping the body.

footer_class

A string, the class added to the div wrapping the footer.

Value

A string of HTML.

Examples

Run this code
# NOT RUN {
div(
button(
type = "button",
class = "btn btn-primary",
custom_attr = list(
  "data-bs-toggle" = "modal",
  "data-bs-target" = "#modal1"
),
"Launch Modal"
),
bs_modal(
  id = "modal1",
  body = p("Here is the modal.")
)
)
# }

Run the code above in your browser using DataLab