navigation: Page Navigation

Description Usage Arguments Examples

View source: R/navigation.R

Description

Create a container for page navigation buttons. The navigation function returns a container for the page navigation buttons.

Usage

1

Arguments

...

Navigation buttons (back_btn, forward_btn)

Examples

 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)
}

InControlofEffects/iceComponents documentation built on April 1, 2021, 5:51 a.m.