Hide panel headers with shinyjs
moa-incom opened this issue · 1 comments
Is it possible to hide the header (or the top rule when no headers are provided) in panels with shinyjs::hide or toggle? Is this on purpose or is it a bug?
Short reproducible example:
library(shiny)
library(shinyjs)
library(shinywidgets)
shinyApp(
ui = fluidPage(
useShinyjs(), # Set up shinyjs
actionButton("btn", "Click me"),
panel(id = "text", heading = "TESTER",
textInput("text2", "Text")
)
),
server = function(input, output) {
observeEvent(input$btn, {
# Change the following line for more examples
toggle("text")
})
}
)
This isn't a bug. It's because some elements, some as panels and tabs, are complex and don't actually get the same ID in the HTML DOM as the one that you tell shiny about. They work a little differently. If you look at the FAQ section you'll see there's two examples of how to show/hide special elements, and panels are similar (the ID is only given to the inside of the panel, not to the entire thing, that's why the inner part only gets hidden).
You'll have to find out the CSS selector of the entire panel and use the selector
parameter instead of id
.