Unable to customize navlistPanel() header styles

Is there a way to customize the appearance of headers in a navlistPanel()? I would normally do that with tags$span() or something similar, but anything other than plain text seems to render in the main content, not the menu. Is this a bug?

library(shiny)

ui <- fluidPage(
  navlistPanel(
    tabPanel("Tab 1", "Content 1"),
    tabPanel("Tab 2", "Content 2"),
    # Plain text works - only appears in menu
    "GOOD: This appears in menu",
    tabPanel("Tab 3", "Content 3"),
    # bug? this adds a weird space to the menu and appears in main content
    tags$span("Bad: This span appears in main content"),
    tabPanel("Tab 4", "Content 4")
  )
)

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

shinyApp(ui, server)

What is your expected result? Would you like to style the titles of the tabPanels? Otherwise, running your code provides us with a meaningful warning:

Warning message:
Navigation containers expect a collection of bslib::nav_panel()/shiny::tabPanel()s and/or bslib::nav_menu()/shiny::navbarMenu()s. Consider using header or footer if you wish to place content above (or below) every panel's contents.

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.