What is a good way to change a Shiny app title? In the example app below I have a radioButtons input and I'd like the app title ("Project Title") to change given the radio selection.
library(shiny)
ui <- navbarPage("Project Title",
tabPanel(title = "Tab 1",
radioButtons("title_change", label = "Change title of App", choices = c("Title 1", "Title 2"))
)
)
server <- function(input, output) {
}
shinyApp(ui = ui, server = server)
You can do this with a shiny::textOutput and shiny::renderText
library(shiny)
ui <- navbarPage(textOutput("title"),
tabPanel(title = "Tab 1",
radioButtons("title_change", label = "Change title of App", choices = c("Title 1", "Title 2"))
)
)
server <- function(input, output) {
output$title <- renderText({
input$title_change
})
}
shinyApp(ui = ui, server = server)
When you change your radio button, that changes input$title_change. When that changes, it updates output$title.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With