R/banner.R

Defines functions banner

Documented in banner

#' Banner Function
#'
#' This function create a detail component that you can click for further
#' details.
#' @param inputId The input slot that will be used to access the value.
#' @param type Main type of label e.g. alpha or beta.  Can be any word.
#' @param label test to display.
#' @return a banner html shiny object
#' @keywords banner
#' @export
#' @examples
#' if (interactive()) {
#'
#'   ui <- fluidPage(
#'     shinyGovstyle::header(
#'       main_text = "Example",
#'       secondary_text = "User Examples",
#'       logo="shinyGovstyle/images/moj_logo.png"),
#'     shinyGovstyle::banner(
#'       inputId = "banner", type = "beta", 'This is a new service')
#'   )
#'
#'   server <- function(input, output, session) {}
#'
#'   shinyApp(ui = ui, server = server)
#' }

banner <-function(inputId, type, label){
  govBanner <- shiny::tags$div(
    class="govuk-phase-banner govuk-width-container govuk-main-wrapper",
    id = inputId,
    shiny::tags$p(class="govuk-phase-banner__content",
      shiny::tags$strong(
        class="govuk-tag govuk-phase-banner__content__tag ", type
      ),
      shiny::tags$span(class="govuk-phase-banner__text", shiny::HTML(label))
    )
  )
  attachDependency(govBanner)
}

Try the shinyGovstyle package in your browser

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

shinyGovstyle documentation built on March 18, 2022, 7:24 p.m.