express.ui.page_opts

express.ui.page_opts(title=MISSING, window_title=MISSING, lang=MISSING, theme=MISSING, page_fn=MISSING, fillable=MISSING, full_width=MISSING, **kwargs)

Set page-level options for the current app.

The arguments to this function get passed to page_auto, which determines which page function should be used based on the page options and the top-level items in the app.

If there is a top-level nav_panel, page_auto will use page_navbar. Otherwise, if there is a top-level sidebar, page_sidebar is used.

If there are neither top-level nav panels nor sidebars, this will use the fillable and full_width arguments to determine which page function to use:

  1. If fillable is True, page_fillable is used.
  2. Otherwise, if full_width is True, page_fluid is used.
  3. If neither are True, page_fixed is used.

Parameters

title: str | MISSING_TYPE = MISSING

A title shown on the page.

window_title: str | MISSING_TYPE = MISSING

The browser window title. If no value is provided, this will use the value of title.

lang: str | MISSING_TYPE = MISSING

ISO 639-1 language code for the HTML page, such as "en" or "ko". This will be used as the lang in the <html> tag, as in <html lang="en">. The default, None, results in an empty string.

theme: str | Path | ThemeProvider | MISSING_TYPE = MISSING

A path to a local or online CSS file that will replace the Bootstrap CSS bundled by default with a Shiny app. This file should be a complete bootstrap.css or bootstrap.min.css file.

For advanced uses, you can also pass a Tagifiable object. In this case, Shiny will suppress the default Bootstrap CSS.

To modify the theme of an app without replacing the Bootstrap CSS entirely, use include_css to add custom CSS.

fillable: bool | MISSING_TYPE = MISSING

If there is a top-level sidebar or nav, then the value is passed through to the page_sidebar or page_navbar function. Otherwise, if True, use page_fillable, where the content fills the window; if False (the default), the value of full_width will determine which page function is used.

full_width: bool | MISSING_TYPE = MISSING

This has an effect only if there are no sidebars or top-level navs, and fillable is False. If this is False (the default), use use page_fixed; if True, use page_fillable.

page_fn: Callable[…, Tag] | None | MISSING_TYPE = MISSING

The page function to use. If None (the default), will automatically choose one based on the arguments provided. If not None, this will override all heuristics for choosing page functions.

**kwargs: object = {}

Additional arguments to pass to the page function. See the description above for further details on how the page function is selected.

Examples

#| standalone: true
#| components: [editor, viewer]
#| layout: vertical
#| viewerHeight: 400

## file: app.py
from shiny.express import ui

ui.page_opts(title="App with Navbar", fillable=True, id="page")

with ui.sidebar():
    ui.input_select("data", "Dataset", ("tips", "flights", "exercise"))

    with ui.panel_conditional("input.page === 'View'"):
        ui.input_select("view", "View", ("plot", "table"))

ui.nav_spacer()

with ui.nav_panel("Data"):
    "This page could be used to pick a dataset."

with ui.nav_panel("View"):
    "This page could be used to view the dataset."
    "Notice the additional controls that appear when 'View' is selected."