Learn R Programming

shinyjs (version 0.0.7.0)

hidden: Initialize a Shiny tag as hidden

Description

Create a Shiny tag that is invisible when the Shiny app starts. The tag can be made visible later with shinyjs::toggle or shinyjs::show.

Usage

hidden(...)

Arguments

...
Shiny tag (or tagList or list of of tags) to make invisible

Value

  • The tag (or tags) that was given as an argument in a hidden state.

See Also

useShinyjs, toggle, show, hide

Examples

Run this code
if (interactive()) {
  shiny::shinyApp(
    ui = shiny::fluidPage(
      useShinyjs(),  # Set up shinyjs
      shiny::actionButton("btn", "Click me"),
      hidden(
        shiny::p(id = "element", "I was born invisible")
      )
    ),
    server = function(input, output, session) {
      shiny::observeEvent(input$btn, {
        show("element")
      })
    }
  )
}

hidden(shiny::span(id = "a"), shiny::div(id = "b"))
hidden(shiny::tagList(shiny::span(id = "a"), shiny::div(id = "b")))
hidden(list(shiny::span(id = "a"), shiny::div(id = "b")))

Run the code above in your browser using DataLab