express.ui.page_opts
express.ui.page_opts(=MISSING,
title=MISSING,
window_title=MISSING,
lang=MISSING,
theme=MISSING,
page_fn=MISSING,
fillable=MISSING,
full_width**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:
- If
fillable
isTrue
,page_fillable
is used. - Otherwise, if
full_width
isTrue
,page_fluid
is used. - 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 |
ui
.Theme |ThemeProvider
| MISSING_TYPE = MISSING-
A custom Shiny theme created using the Theme class, or 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
orbootstrap.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
orpage_navbar
function. Otherwise, ifTrue
, usepage_fillable
, where the content fills the window; ifFalse
(the default), the value offull_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
isFalse
. If this isFalse
(the default), use usepage_fixed
; ifTrue
, usepage_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 notNone
, 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."