showFeedback {shinyFeedback} | R Documentation |
showFeedback
Description
Show feedback next to Shiny inputs.
Usage
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")
)
Arguments
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 |
Examples
## 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)
}
[Package shinyFeedback version 0.4.0 Index]