Skip to content

Vertical Tabset Does not work with bslib using Bootstrap 5 #549

@justacec

Description

@justacec

When I try to use the Vertical Tabset in addition to using Bootstrap5, the content of the tab shows up below the tab buttons vice to thg right as expected.

Versions

ShinyWidgets: 0.7.5
Shiny: 1.7.2
bslib: 0.4.1
R: 4.2.0

Example Code

library(shiny)
library(shinyBS)
library(shinyWidgets)
library(bslib)

ui <-  shinyUI(fluidPage(
  theme = bs_theme(version = 5, bootswatch = 'sandstone'),
  titlePanel("Example"),
  sidebarLayout(
    sidebarPanel(
      selectInput("decision", label = "Choose your species", 
                  choices = unique(iris$Species), 
                  selected = unique(iris$Species), multiple = TRUE),
      actionButton("show", "Show")
    ),
    mainPanel(
    )
  )
))

server <- shinyServer(function(input, output, session) {
  
  output$mytabs <- renderUI({
    nTabs <- length(input$decision)
    # create tabPanel with datatable in it
    myTabs <- lapply(seq_len(nTabs), function(i) {
      verticalTabPanel(paste0("dataset_", input$decision[i]),
               tableOutput(paste0("datatable_",i))       
      )
    })
    
    do.call(verticalTabsetPanel, myTabs)
  })
  
  observeEvent(input$show, {
    showModal(modalDialog("modalExample",
            "myTitle",
            size = 'xl',
            uiOutput('mytabs'),
            easyClose = TRUE
    ))
  })
  
  # create datatables in popup ?
  observe(
    lapply(seq_len(length(input$decision)), function(i) {
      output[[paste0("datatable_",i)]] <- renderTable({
        as.data.frame(iris[iris$Species == input$decision[i], ])
      })
    })  
  ) 
  
})

shinyApp(ui, server)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions