-
Notifications
You must be signed in to change notification settings - Fork 117
Closed
Description
In Shiny for R, all page functions take a theme argument, with the following behavior:
- If
NULL, use Bootstrap 3 - If a scalar string, assume it's a client-side path to a CSS file and add a
<link>element to the page<head>. Note that base Bootstrap 3 is still included in this case. - If a bslib theme, add
bslib::bs_theme_dependencies(theme)but not the base Bootstrap dependency after registering the theme (so that it can be used for runtime Sass compilation).
I'm proposing the following approach to theme in Python:
theme=MISSINGordefault casetheme=ui.theme()- Uses the default Shiny Bootstrap theme.
theme: str | Path- Uses
ui.include_css(theme)to include the CSS file. Shiny's Bootstrap bundle is still added, but without including the Bootstrap stylesheet.
- Uses
-
theme=ui.theme( theme: str | HTMLDependency | Tagifiable, bs_version: Optional[str], replace = "css" | "all" | "none" )- Allows a CSS file, HTML dependency or a tagifiable that returns an HTML dependency to provide the theme.
- Includes optional
bs_versionthat can be used for runtime checks to warn if the provided Bootstrap theme is out-of-date with Shiny's provided Bootstrap version. - Allows theme providers to determine if the theme
replaces the"css"of Shiny's Bootstrap bundle, the entire ("all") Bootstrap bundle, or the theme is overlaid over base Bootstrap ("none").
- For completeness,
themecould also be a dict with keystheme,bs_version,replacesuch thatui.theme(**dict)returns a full theme object.
The first two cases can be seen as a short-cut for providing ui.theme(), which itself returns a Theme or ShinyTheme instance.
Metadata
Metadata
Assignees
Labels
No labels