Skip to contents

Changes the browser tab title from server code, optionally composing it with a service name (e.g. "Relat\u00f3rio | Meu Sistema"). Requires the GovBR dependencies (use_govbr() or any br_* component).

Usage

br_update_page_title(
  page_title,
  service_name = NULL,
  session = shiny::getDefaultReactiveDomain()
)

Arguments

page_title

New page title (single non-empty string).

service_name

Optional service name appended after the title, separated by " | ".

session

The shiny session object (defaults to the current one).

Value

Invisible NULL, called for its side effect.

Examples

if (interactive()) {
  ui <- shiny::fluidPage(
    use_govbr(),
    shinyGovBRstyle::br_button("rel", "Gerar relat\u00f3rio")
  )
  server <- function(input, output, session) {
    shiny::observeEvent(input$rel, {
      shinyGovBRstyle::br_update_page_title(
        page_title = "Relat\u00f3rio gerado",
        service_name = "Meu Sistema"
      )
    })
  }
  shinyApp(ui = ui, server = server)
}