Learn R Programming

shinyFeedback (version 0.0.3)

feedback: feedback

Description

displays feedback next to Shiny input

Usage

feedback(inputId, condition, text = NULL, color = NULL, icon = NULL)

Arguments

inputId

the Shiny input's inputId argument

condition

condition under which feeback is displayed

text

text string to display below input

color

the color of the feeback

icon

a shiny::icon object

See Also

feedbackWarning, feedbackDanger, feedbackSuccess

Examples

Run this code
# NOT RUN {
## Only run examples in interacive R sessions
if (interactive()) {
  ui <- fluidPage(
    useShinyFeedback(),
    
    numericInput(
      "exampleInput",
      "Show Feedback When < 0",
      value = -5
    )
  )
  
  server <- function(input, output) {
    observeEvent(input$exampleInput, {
      feedback(
        "exampleInput",
        condition = input$exampleInput < 0,
        text = "I am negative",
        color = "#d9534f",
        icon = shiny::icon("exclamation-sign", lib="glyphicon")
      )
    })
  }
  
  shinyApp(ui, server)
}

# }

Run the code above in your browser using DataLab