bsplus icon indicating copy to clipboard operation
bsplus copied to clipboard

bs_accordion_sidebar is not changing content_main

Open trafficonese opened this issue 4 years ago • 1 comments

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)

trafficonese avatar Oct 25 '19 11:10 trafficonese

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)

ijlyttle avatar May 17 '20 21:05 ijlyttle