Closed fmmattioni closed 3 years ago
My bad, I didn't realize I should be using tagList()
.
Solution:
---
title: "Untitled"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
library(magrittr)
htmltools::tagList(lapply(1:2, function(i) {
bsplus::bs_modal(id = paste0("button_", i), title = paste0("modal ", i), body = NULL)
}))
htmltools::tagList(lapply(1:2, function(i) {
bsplus::bs_button(paste0("Modal ", i)) %>%
bsplus::bs_attach_modal(paste0("button_", i))
}))
Hi @ijlyttle,
Thanks again for this great package!
I have been wondering one thing: what is the right way to create several
bsplus::bs_modal()
in a loop inrmarkdown
? My approach usinglapply
works quite well inshiny
, but I still haven't found a way to make this work in my.Rmd
file.Minimal
.Rmd
reprex with desired outcome: