bs_modal | R Documentation |
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") )
id |
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). |
header |
A string, likely HTML, that goes in the header div after the title. |
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_attr |
A named list or named vector, names are attribute names and values are attribute values. Added to the the div wrapping the dialog. |
dialog_attr |
A named list or named vector, names are attribute names and values are attribute values. Added to the the div wrapping the content wrapper. |
content_attr |
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). |
header_attr |
A named list or named vector, names are attribute names and values are attribute values. Added to the the div wrapping the header. |
title_attr |
A named list or named vector, names are attribute names and values are attribute values. Added to the the div wrapping the title. |
body_attr |
A named list or named vector, names are attribute names and values are attribute values. Added to the div wrapping the body. |
footer_attr |
A named list or named vector, names are attribute names and values are attribute values. Added to the div wrapping the footer. |
A string of HTML.
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.") ) )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.