Description Usage Arguments See Also Examples
html_toogle
will display an element if hidden or hide it
if visible.
html_set_visible
will make an element visible.
html_set_hidden
will hide an element.
1 2 3 4 5 | html_toogle(id, protect_id = FALSE)
html_set_visible(id, protect_id = FALSE)
(id, protect_id = FALSE)
|
id |
shiny input id |
protect_id |
wether to process shiny input id with
function |
Other javascript functions: ability
,
activate
, click_event
,
html_class
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | library(shinytools)
if (interactive()) {
options(device.ask.default = FALSE)
ui <- fluidPage(
titlePanel("Hello dghiesse!"),
load_jstools(),
sidebarLayout(
sidebarPanel(
sliderInput( "obs",
"Number of observations:",
min = 0, max = 1000, value = 500),
actionButton("toogle", "toogle"),
actionButton("set_visible", "show"),
actionButton("set_hidden", "hide")
),
mainPanel(
plotOutput("distPlot")
)
)
)
server <- function(input, output) {
output$distPlot <- renderPlot({
hist(rnorm(input$obs))
})
observeEvent(input$toogle, {
html_toogle("distPlot")
})
observeEvent(input$set_visible, {
html_set_visible("distPlot")
})
observeEvent(input$set_hidden, {
("distPlot")
})
}
print(shinyApp(ui, server))
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.