dropdown: Create dropdown Semantic UI component

Description Usage Arguments Examples

View source: R/dsl.R

Description

This creates a default dropdown using Semantic UI styles with Shiny input. Dropdown is already initialized and available under input[[name]].

Usage

1
2
dropdown(name, choices, choices_value = choices, default_text = "Select",
  value = NULL)

Arguments

name

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

choices

All available options one can select from.

choices_value

What reactive value should be used for corresponding choice.

default_text

Text to be visible on dropdown when nothing is selected.

value

Pass value if you want to initialize selection for dropdown.

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
## Only run examples in interactive R sessions
if (interactive()) {

  library(shiny)
  library(shiny.semantic)
  ui <- function() {
      shinyUI(
        semanticPage(
          title = "Dropdown example",
          suppressDependencies("bootstrap"),
          uiOutput("dropdown"),
          p("Selected letter:"),
          textOutput("selected_letter")
       )
     )
  }
  server <- shinyServer(function(input, output) {
     output$dropdown <- renderUI({
         dropdown("simple_dropdown", LETTERS, value = "A")
     })
     output$selected_letter <- renderText(input[["simple_dropdown"]])
  })

  shinyApp(ui = ui(), server = server)
}

Appsilon/shiny.semantic documentation built on Aug. 17, 2017, 2:53 p.m.