Skip to contents

This function create a gov style footer for your page

Usage

footer(full = FALSE, links = NULL)

Arguments

full

Whenever you want to have blank footer or official gov version. Defaults to FALSE

A vector of actionLinks to be added to the footer, inputIDs are auto-generated and are the snake case version of the link text, e.g. "Accessibility Statement" will have an inputID of accessibility_statement

Value

a footer html shiny object

Details

You can add actionLinks as links in the footer through using the links_list argument.

Links in the footer should be used sparingly and are usually for supporting information pages such as the accessibility statement, privacy notice, cookies information or link to a statement of voluntary adoption of the statistics code of practice.

Generally when using footer links you will be controlling a hidden tabset so to the end user it looks like it is a new page.

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"
    ),
    tags$br(),
    tags$br(),
    shinyGovstyle::footer(full = TRUE)
  )

  server <- function(input, output, session) {}

  shinyApp(ui = ui, server = server)
}

# Add links
footer(links = c("Accessibility statement", "Cookies"))
#> <footer class="govuk-footer " role="contentinfo">
#>   <div class="govuk-width-container ">
#>     <div class="govuk-footer__meta">
#>       <div class="govuk-footer__meta-item govuk-footer__meta-item--grow">
#>         <div>
#>           <h2 class="govuk-visually-hidden">Support links</h2>
#>           <ul class="govuk-footer__inline-list">
#>             <li class="govuk-footer__inline-list-item">
#>               <a class="action-button govuk-link govuk-footer__link" href="#" id="accessibility_statement">Accessibility statement</a>
#>             </li>
#>             <li class="govuk-footer__inline-list-item">
#>               <a class="action-button govuk-link govuk-footer__link" href="#" id="cookies">Cookies</a>
#>             </li>
#>           </ul>
#>         </div>
#>       </div>
#>     </div>
#>   </div>
#> </footer>

# Full app with link controlling a hidden tab
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"
    ),
    shiny::tabsetPanel(
      type = "hidden",
      id = "tabs",
      shiny::tabPanel(
        "Main content",
        value = "main",
        heading_text("Hello world!")
      ),
      shiny::tabPanel(
        "Cookies",
        value = "cookies",
        heading_text("Cookies")
      )
    ),
    shinyGovstyle::footer(
      full = TRUE,
      links = c("Accessibility statement", "Cookies")
    )
  )

  server <- function(input, output, session) {
    shiny::observeEvent(input$cookies, {
      shiny::updateTabsetPanel(session, "tabs", selected = "cookies")
    })
  }

  shinyApp(ui = ui, server = server)
}