Problem:
I’m working on a Shiny app using the bs4Dash package, and I have a tabCard containing nested tabsetPanels. However, there is a small tab at the top of the ‘tabCard’ that I’d like to remove, as it provides unwanted functionality and is a visual distraction. I’ve tried looking for options within the bs4TabCard function, but I haven’t found a solution yet. I would like the tabs and sub-tabs to be displayed in a ‘bs4Dash::tabBox’ or ‘bs4Dash::tabCard’.
Reprex:
ui <- bs4Dash::bs4DashPage(
header = bs4Dash::bs4DashNavbar(),
sidebar = bs4Dash::bs4DashSidebar(disable = TRUE),
body = bs4Dash::bs4DashBody(
fluidPage(
bs4Dash::bs4TabCard(
width = 12,
collapsible = FALSE,
tabsetPanel(
id = "main_tabs",
tabPanel("Price",
tabsetPanel(
id = "price_tabs",
tabPanel("Mandelbrot", "Content for Mandelbrot"),
tabPanel("Momentum", "Content for Momentum"),
tabPanel("Past Returns", "Content for Past Returns")
)
),
tabPanel("Volume",
tabsetPanel(
id = "volume_tabs",
tabPanel("Momentum", "Content for Momentum"),
tabPanel("Historical", "Content for Historical")
)
),
tabPanel("Volatility",
tabsetPanel(
id = "volatility_tabs",
tabPanel("Momentum", "Content for Momentum"),
tabPanel("IVOL/RVOL", "Content for IVOL/RVOL"),
tabPanel("Gross/Degross", "Content for Gross/Degross")
)
),
tabPanel("Positioning",
tabsetPanel(
id = "positioning_tabs",
tabPanel("Put/Call/Ratio", "Content for Put/Call/Ratio"),
tabPanel("Short Interest", "Content for Short Interest"),
tabPanel("Number of Shares", "Content for Number of Shares")
)
)
)
)
)
),
controlbar = NULL,
footer = NULL
)
server <- function(input, output, session) {
}
shinyApp(ui, server)
I have tried to move around and change different bs4Dash components or shiny components but I can’t seem to find the right combination. There is a possible solution by hiding the header with some CSS, but I would prefer to not go about it this way, as it seems possible to do with the correct layout of components.
Thanks!
2
Answers
This is the current implementation of solving this, but I would like to reduce all CSS styling if I can to simplify and speed up the code.
Use
bs4Card()
instead ofbs4TabCard()
: