As the title suggests, I'm trying to trigger an event to occur when I maximize/un-collapse a box(). The code below doesn't work (Error in : shinyjs: Invalid shiny tags given to hidden
) but it's more or less what I'm trying to do.
The box object is a bs4Dash::box.
How do I accomplish this?
library(shiny)
library(shinyjs)
ui <- fluidPage(
useShinyjs(),
bs4Dash::box(id = "myBox", "This is my box")
)
server <- function(input, output) {
observe({
if (shinyjs::hidden("myBox")) {
# do something when the box is collapsed
print("Box is collapsed!")
}
})
}
shinyApp(ui, server)