Description Usage Arguments Examples
Show feedback next to Shiny inputs.
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 | showFeedback(
inputId,
text = NULL,
color = NULL,
icon = NULL,
session = shiny::getDefaultReactiveDomain()
)
showFeedbackWarning(
inputId,
text = "Ye be warned",
color = "#F89406",
icon = shiny::icon("warning-sign", lib = "glyphicon"),
session = shiny::getDefaultReactiveDomain()
)
showFeedbackDanger(
inputId,
text = "Danger, turn back!",
color = "#d9534f",
icon = shiny::icon("exclamation-sign", lib = "glyphicon"),
session = shiny::getDefaultReactiveDomain()
)
showFeedbackSuccess(
inputId,
text = NULL,
color = "#5cb85c",
icon = shiny::icon("ok", lib = "glyphicon")
)
|
inputId |
the Shiny input's |
text |
text string to display below input |
color |
the color of the feedback |
icon |
an html icon tag |
session |
the |
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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | ## 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, {
if (input$exampleInput < 0) {
showFeedback(
"exampleInput",
text = "I am negative",
color = "#d9534f",
icon = shiny::icon("exclamation-sign", lib="glyphicon")
)
} else {
hideFeedback("exampleInput")
}
})
}
shinyApp(ui, server)
}
## Only run examples in interacive R sessions
if (interactive()) {
library(shiny)
ui <- fluidPage(
useShinyFeedback(),
numericInput(
"exampleInput",
"Show Feedback When < 0",
value = -5
)
)
server <- function(input, output, session) {
observeEvent(input$exampleInput, {
if (input$exampleInput < 0) {
showFeedbackWarning("exampleInput")
} else {
hideFeedback("exampleInput")
}
})
}
shinyApp(ui, server)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.