Reactive title text will not plot in navset_card_pill. Is there a feature of navset_card_pill that prevents it from plotting reactive titles?

,

I'm trying to put together a R shiny app using bslib that includes a navset_card_pill tab feature.

I would like to include a title for the navset_card_pill that changes according to a reactive input. In the reprex below this input is a simple 3-option dropdown list ("option").

But I've found that although the reactive title will plot on the sidebar, it will not plot as the title for the navset_card_pill. A non-reactive title ("Test Title" in the reprex ) will plot as the navset_card_pill title though.

Is there a feature of navset_card_pill that prevents it from plotting reactive titles? Or, is there something I'm missing that is required for it to plot a reactive title?

Thanks in advance for any help.

################## REPREX

library(base)
library(glue)
library(shiny)
library(stringi)
library(bslib)
library(tidyverse)

optionList <- c("Option1","Option2","Option3")

ui <- page_sidebar(

This sidebar title plots

title=h1("Navset_Title_Test"),
theme = bs_theme( bootswatch="darkly"),
sidebar = sidebar(
position = "left",
title = h1(textOutput("optionType")),
selectInput("option","Select an Option",optionList,multiple=FALSE,width ='120px')
), # sidebar

navset_card_pill(

#. This title does not plot
title = h1(textOutput("optionType")),
#. Title below does plot when de-commented

title = h1("Test Title"),

    nav_panel(h2("Tab1"),
              br(),
              p(stri_rand_lipsum(1, start_lipsum = TRUE)),
              p(stri_rand_lipsum(1, start_lipsum = TRUE))
              ),
    nav_panel(h2("Tab2"),
              br(),
              p(stri_rand_lipsum(1, start_lipsum = TRUE)),
              p(stri_rand_lipsum(1, start_lipsum = TRUE))
             ),
    nav_spacer()
) # navset_card_pill  

) # page_sidebar

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

output$optionType <- renderText({
paste(input$option)
})

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

Run the app

shinyApp(ui, server)

...

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.