R/useShinyFeedback.R

Defines functions useShinyFeedback

Documented in useShinyFeedback

#' useShinyFeedback
#' 
#' function to load js for using \code{shinyFeedback}
#' 
#' @param feedback boolean: source in JS/CSS to use shinyFeedback functions (Default: TRUE)
#' @param toastr boolean: source in JS/CSS to use showToast functions (Default: TRUE)
#'
#' @importFrom htmltools tagList
#' 
#' @section Example:
#' \preformatted{
#'   ui <- shinyUI(fluidPage(
#'     useShinyFeedback(
#'       feedback = TRUE,
#'       toastr = TRUE
#'     ),
#'     pageWithSidebar(
#'       headerPanel("Header"),
#'       sidebarPanel(
#'         ...
#'       ),
#'       mainPanel(
#'         ...
#'       )
#'     )
#'   ))
#' }
#' 
#' 
#' @export
#' 
useShinyFeedback <- function(
  feedback = TRUE,
  toastr = TRUE
) {
  
  feedback_deps <- NULL
  if (isTRUE(feedback)) {
    feedback_deps <- htmltools::tagList(
      feedbackDependency(),
      fontAwesomeDependency()
    )
  }
  
  toastr_deps <- NULL
  if (isTRUE(toastr)) {
    toastr_deps <- toastrDependency()
  }

  htmltools::tagList(
    feedback_deps,
    toastr_deps
  )
}

Try the shinyFeedback package in your browser

Any scripts or data that you put into this service are public.

shinyFeedback documentation built on Jan. 8, 2021, 5:41 p.m.