Learn R Programming

shiny.semantic (version 0.3.0)

uislider: Create Semantic UI Slider

Description

This creates a slider input using Semantic UI. Slider is already initialized and available under input[[name]].

Usage

uislider(name, value, min, max, step = 1, type = NULL)

uirange(name, value, value2, min, max, step = 1, type = NULL)

Arguments

name

Input name. Reactive value is available under input[[name]].

value

The initial value to be selected for the sldier (lower value if using range).

min

The minimum value allowed to be selected for the slider.

max

The maximum value allowed to be selected for the slider.

step

The interval between each selectable value of the slider.

type

UI class of the slider. Can include "Labeled" and "ticked".

value2

The initial upper value of the slider.

Details

Use update_slider to update the slider/range within the shiny session.

See Also

update_slider for input updates, https://fomantic-ui.com/modules/slider.html for preset classes.

Examples

Run this code
# NOT RUN {
if (interactive()) {

  library(shiny)
  library(shiny.semantic)

  # Slider example
  ui <- shinyUI(
    semanticPage(
      title = "Slider example",
      tags$br(),
      uislider("slider", 10, 0, 20),
      p("Selected value:"),
      textOutput("slider")
    )
  )

   server <- shinyServer(function(input, output, session) {
     output$slider <- renderText(input$slider)
   })

   shinyApp(ui = ui, server = server)

   # Range example
   ui <- shinyUI(
     semanticPage(
       title = "Range example",
       tags$br(),
       uirange("range", 10, 15, 0, 20),
       p("Selected values:"),
       textOutput("range")
    )
  )

   server <- shinyServer(function(input, output, session) {
     output$range <- renderText(paste(input$range, collapse = " - "))
   })

   shinyApp(ui = ui, server = server)

 }

# }

Run the code above in your browser using DataLab