Skip to contents

shinyreact::page_react() emits no body HTML and, unless you pass a theme, serves no Bootstrap. glass_theme() is a bslib::bs_theme(), so the supported call is page_react(theme = glass_theme()). Passing the theme as an unnamed argument does not set that parameter: shinyreact then suppresses the Bootstrap dependency, which is also where the compiled glass CSS lives, and the page keeps the JS without the look.

Usage

glass_page_react(..., theme = NULL)

Arguments

...

Passed to shinyreact::page_react() (src_dir, title, lang, and so on). Do not pass theme here.

theme

A glass_theme() (or other bslib::bs_theme()). Defaults to glass_theme().

Value

UI suitable for shinyApp(ui = ...).

Details

glass_page_react() is that call, plus glass_react_dependency(). The React client still owns the DOM. Build it from GlassPage, GlassSidebar, GlassSurface / GlassCard, and GlassButton on window.shinyglass. useGlassTheme() tracks the live mode (light / dark / auto), the resolved preset, scene, material, and intensity, plus refraction, morph, press, scroll edge, tab minimize, icon style, and floating sidebar, and whether Reduce Transparency, Increase Contrast, reduced motion, or forced colors are active. Its setters call window.shinyglass.setPreset() and the other mutators, including setRefraction() and setIconStyle(). GlassIntensitySlider runs from Ultra Clear to Tinted and defaults to 0.5. setMaterial("clear") is deprecated and maps to intensity 0.12. Wallpaper, type, and --glass-* tokens apply to the document. Those component classes are what pick up Liquid Glass. Do not set panel or text colors in the client's own CSS.

Shadow roots do not see document class rules. --glass-* custom properties inherit. Call window.shinyglass.adoptShadow(shadowRoot) from the component that created the root to inject a .glass-surface rule.

For shinyreact::page_react_html(), pass glass_theme_dependencies() as extra_deps. That helper does not need shinyreact. It includes the React module.

Examples

if (interactive() && requireNamespace("shinyreact", quietly = TRUE)) {
  # App directory must contain www/ui.js. See the shipped example:
  # system.file("examples/shinyreact-glass", package = "shinyglass")
  ui <- glass_page_react(theme = glass_theme(preset = "auto", scene = "tahoe"))
}