Skip to content

Shiny Express is missing panel_title() #1011

@gadenbuie

Description

@gadenbuie

panel_title() is missing from Shiny Express. Its usage is partially covered by shiny.ui.page_opts(), which exposes title (but not window_title) and passes title to page functions that take the argument.

I think that, for consistency, we should offer shiny.express.ui.panel_title(). Secondarily, we can augment shiny.express.ui.page_opts() to take window_title and to also, possibly, insert title into the older page functions like page_fluid().

panel_title() takes two arguments, title and window_title. When provided by the user, window_title is always static, but title could be a simple static value or it could involve dynamic UI:

from shiny import render
from shiny.express import input, ui

# Static title option ----
# ui.panel_title(title="Page title", window_title="Window title")

# Dynamic title option ----
with ui.panel_title(window_title="Static window title"):

    @render.ui
    def page_title():
        page = input.page() if "page" in input else "Home"
        return ui.h2(f"{page} title")


ui.input_select("page", "Page", ["Home", "About", "Contact"])

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions