How to create a checkboxInput which, when checked, expands a box with options?

For the code below I need to add a snippet that would allow me, after selecting an option in the first checkboxInput (choice), to expand a separate box with the rest of the options. How can I make these options closable.

ui <- dashboardPage(
    dashboardHeader(title = "X"),
    dashboardSidebar(
        checkboxInput("choice", "Are you into it?"),
        checkboxGroupInput("stages", "Stages: ", choices = c("First", "Second", "Third")),
        selectInput("status", "Status of this card: ", choices = c(" ", "Active", "Closed")),
        dateInput(inputId = "date", label = "Choose date : "),
        sliderInput(inputId = "inactivity", label = "Time of inactivity ", min = 6, max = 24, value = 10)
        ),
    dashboardBody(
        dataTableOutput(outputId = "table")
    )
)

Are you after something like a conditional panel?

https://shiny.rstudio.com/reference/shiny/latest/conditionalPanel.html

Actually yes, but I didn't work. Maybe I did it in wrong way. The part of code looks that:

checkboxInput("choice", "Are you into it?"),
        conditionalPanel(
            condition = "input.choice == 'T'",
            checkboxGroupInput("stages", "Stages: ", choices = c("First", "Second", "Third")),
            selectInput("status", "Status of this card: ", choices = c(" ", "Active", "Closed"))   
        ),

Try this:

condition = "input.choice == 1",

It works in this example:

library(shiny)
ui <- fluidPage(
  sidebarPanel(
    checkboxInput("choice", "Are you into it?"),

    conditionalPanel(
      condition = "input.choice == 1",
      checkboxGroupInput("stages", "Stages: ", choices = c("First", "Second", "Third")),
      selectInput("status", "Status of this card: ", choices = c(" ", "Active", "Closed"))   
    )
  )
)

server <- function(input, output) {
 
}

shinyApp(ui, server)

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.