Learn more at https://getbootstrap.com/docs/5.1/components/modal/.
bs_modal(
id,
header = button(attr = c(type = "button", class = "btn-close", `data-bs-dismiss` =
"modal", `aria-label` = "Close")),
title = h5("Note"),
body,
footer = button(attr = c(type = "button", class = "btn btn-secondary",
`data-bs-dismiss` = "modal"), "Close"),
modal_attr = c(class = "modal", tabindex = "-1"),
dialog_attr = c(class = "modal-dialog"),
content_attr = c(class = "modal-content"),
header_attr = c(class = "modal-header"),
title_attr = c(class = "modal-title"),
body_attr = c(class = "modal-body"),
footer_attr = c(class = "modal-footer")
)
A string of HTML.
A string, an id for the modal (to launch the modal, reference this id in the data-bs-target attribute of the HTML element that will launch the modal. See example below).
A string, likely HTML, that goes in the header div after the title.
A string, likely HTML, displayed as the title of the modal.
A string, likely HTML, displayed as the body of the modal.
A string, likely HTML, displayed at the bottom of the modal.
A named list or named vector, names are attribute names and values are attribute values. Added to the the div wrapping the dialog.
A named list or named vector, names are attribute names and values are attribute values. Added to the the div wrapping the content wrapper.
A named list or named vector, names are attribute names and values are attribute values. Added to the the div wrapping the content (header, body, footer).
A named list or named vector, names are attribute names and values are attribute values. Added to the the div wrapping the header.
A named list or named vector, names are attribute names and values are attribute values. Added to the the div wrapping the title.
A named list or named vector, names are attribute names and values are attribute values. Added to the div wrapping the body.
A named list or named vector, names are attribute names and values are attribute values. Added to the div wrapping the footer.
div(
button(
attr = c(
"type" = "button",
"class" = "btn btn-primary",
"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