Description Usage Arguments Value Note See Also Examples
Create a Shiny tag that is invisible when the Shiny app starts. The tag can
be made visible later with toggle() or show().
1  | (...)
 | 
... | 
 Shiny tag (or tagList or list of of tags) to make invisible  | 
The tag (or tags) that was given as an argument in a hidden state.
shinyjs must be initialized with a call to useShinyjs()
in the app's ui.
useShinyjs(), toggle(), show(), hide()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22  | if (interactive()) {
  library(shiny)
  shinyApp(
    ui = fluidPage(
      useShinyjs(),  # Set up shinyjs
      actionButton("btn", "Click me"),
      (
        p(id = "element", "I was born invisible")
      )
    ),
    server = function(input, output) {
      observeEvent(input$btn, {
        show("element")
      })
    }
  )
}
library(shiny)
(span(id = "a"), div(id = "b"))
(tagList(span(id = "a"), div(id = "b")))
(list(span(id = "a"), div(id = "b")))
 | 
Attaching package: 'shinyjs'
The following objects are masked from 'package:methods':
    removeClass, show
Attaching package: 'shiny'
The following object is masked from 'package:shinyjs':
    runExample
[[1]]
<span id="a" class="shinyjs-hide"></span>
[[2]]
<div id="b" class="shinyjs-hide"></div>
[[1]]
<span id="a" class="shinyjs-hide"></span>
[[2]]
<div id="b" class="shinyjs-hide"></div>
[[1]]
<span id="a" class="shinyjs-hide"></span>
[[2]]
<div id="b" class="shinyjs-hide"></div>
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.