Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ui <- bslib::page_sidebar(
- sidebar=bslib::sidebar(
- open="always",
- position="right",
- shiny::selectInput(
- inputId="acc_title",
- label="Accordion Panel's title",
- choices=c("Title 1", "Title 2"),
- selected="Title 1",
- multiple=FALSE
- )
- ),
- bslib::card(
- "Some content",
- bslib::card_footer(
- bslib::accordion(
- id="acc",
- open=FALSE,
- multiple=FALSE,
- bslib::accordion_panel(
- value="acc_panel", # not "id"
- "Title 1",
- "Accordion's content."
- )
- )
- )
- )
- )
- server = function(input, output, session) {
- shiny::observeEvent(input$acc_title, {
- bslib::accordion_panel_update( # <-- crucial part
- id="acc",
- target="acc_panel",
- title = input$acc_title
- )
- })
- }
- shiny::runApp(shinyApp(ui, server))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement