Description Usage Arguments Examples
Create a container for page navigation buttons. The navigation
function
returns a container for the page navigation buttons.
1 |
... |
Navigation buttons ( |
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 | if (interactive()) {
library(shiny)
library(iceComponents)
# define app
ui <- tagList(
use_iceComponents(),
container(
tags$h2("Count by 5's"),
uiOutput("count"),
navigation(
back_btn(inputId = "subtract", label = "Subtract 5"),
back_btn(inputId = "add", label = "Add 5"),
)
)
)
# dynamically render pages based on page navigation
server <- function(input, output) {
counter <- reactiveVal(1)
observeEvent(input$subtract, {
counter(counter() - 5)
output$counter <- renderUI(tags$p(counter()))
})
observeEvent(input$add, {
counter(counter() + 5)
output$count <- renderUI(tags$p(counter()))
})
}
shinyApp(ui, server)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.