ijlyttle / bsplus

Shiny and R Markdown addons to Bootstrap 3
http://ijlyttle.github.io/bsplus/
Other
146 stars 21 forks source link

bs_accordion_sidebar is not changing content_main #71

Open trafficonese opened 4 years ago

trafficonese commented 4 years ago

The content doesn't change when I click on another accordion item. Am I missing something?

library(shiny)
library(htmltools)
library(bsplus)

ui <- fluidPage(
  use_bs_accordion_sidebar(),
  bs_accordion_sidebar(id = "beatles") %>%
    bs_append(
      title_side = "John Lennon", 
      content_side = "Rhythm guitar, vocals",
      content_main = "Dear Prudence"
    ) %>%
    bs_append(
      title_side = "Paul McCartney", 
      content_side = "Bass guitar, vocals",
      content_main = "Blackbird"
    )
)

server <- function(input, output, session) {}

shinyApp(ui, server)
ijlyttle commented 4 years ago

For reasons I did not understand when I wrote it, you have to put use_bs_accordion_sidebar() at the end. I'm sure I can write a fix so that won't be necessary in the future.

library(shiny)
library(htmltools)
library(bsplus)

ui <- fluidPage(
  bs_accordion_sidebar(id = "beatles") %>%
    bs_append(
      title_side = "John Lennon", 
      content_side = "Rhythm guitar, vocals",
      content_main = "Dear Prudence"
    ) %>%
    bs_append(
      title_side = "Paul McCartney", 
      content_side = "Bass guitar, vocals",
      content_main = "Blackbird"
    ),
   use_bs_accordion_sidebar()
)

server <- function(input, output, session) {}

shinyApp(ui, server)