This PR adds the function bs_accordion_multi which modifies a bs_accordion object to control whether one or multiple panels can be open at the same time, and which panel (if any) is initially open.
This function is a bit of a hack, as it It is written to modify the HTML code generated by bs_accordion. Ideally these capabilities would be added to the bs_accordion function.
This example code (from the man page):
library(shiny)
library(bsplus)
shinyApp(
ui = fluidPage(
tags$header(
tags$style(
HTML(
'
.panel-heading.collapsed > .panel-title:before {
float: right !important;
padding-right: 5px;
content:"+"
}
.panel-heading > .panel-title:before {
float: right !important;
font-family: FontAwesome;
padding-right: 5px;
content:"-"
}
'
)
)
),
tags$h2("Multiple Open Panels, Panels 1 and 3 open at page load"),
bs_accordion(id = "beatles") %>%
bs_set_opts(panel_type = "success", use_heading_link = TRUE) %>%
bs_append(title = "John Lennon", content = "Rhythm guitar, vocals") %>%
bs_append(title = "Paul McCartney", content = "Bass guitar, vocals") %>%
bs_append(title = "George Harrison", content = "Lead guitar, vocals") %>%
bs_append(title = "Ringo Starr", content = "Drums, vocals") %>%
bs_accordion_multi(
multi=TRUE,
open=c(1,3)
),
tags$h2("One Open Panel, No panels open on page load."),
bs_accordion(id = "fruit") %>%
bs_set_opts(panel_type = "info") %>%
bs_append(title = "Apples", content = "An apple a day keeps the doctor away.") %>%
bs_append(title = "Bannana", content = "Watch out for bannana peels!") %>%
bs_append(title = "Kumquat", content = "What is a kumquat?!") %>%
bs_accordion_multi(
multi=FALSE,
open=c()
)
),
server = function(input, output) {}
)
}
This PR adds the function
bs_accordion_multi
which modifies abs_accordion
object to control whether one or multiple panels can be open at the same time, and which panel (if any) is initially open.This function is a bit of a hack, as it It is written to modify the HTML code generated by
bs_accordion
. Ideally these capabilities would be added to thebs_accordion
function.This example code (from the man page):
yields:![image](https://user-images.githubusercontent.com/6144863/211112858-48675f65-0516-435e-a515-4443995887be.png)