--- title: "Layout Utilities" output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{Layout Utilities} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- # Overview `shiny.webawesome` is primarily a generated wrapper package, but it also includes a small set of package-level helpers for common layout and page scaffolding tasks. The two main layout helpers are: - `webawesomePage()`, which creates a minimal page scaffold for Shiny apps using the package - `wa_container()`, which creates a plain container element that is convenient for layouts and utility-class usage Neither helper is a generated wrapper for an upstream Web Awesome component. They are package-level conveniences that make it easier to build Shiny apps that use Web Awesome components and utilities. # `webawesomePage()` `webawesomePage()` creates a minimal full-page HTML scaffold and attaches the `shiny.webawesome` dependency once at page level. This is useful because it keeps the page-level setup explicit and avoids relying on dependency attachment from an individual component deeper in the UI tree. ```{r layout-utilities-executed} library(shiny.webawesome) layout_preview <- wa_container( class = "wa-stack", wa_card("First card"), wa_card("Second card") ) cat(as.character(layout_preview), sep = "\n") ``` Here is the same idea in a minimal full Shiny page scaffold: ```{r wa-page-basic, eval = FALSE} library(shiny) library(shiny.webawesome) ui <- webawesomePage( title = "Layout utilities", wa_container( style = "max-width: 32rem; margin: 2rem auto;", wa_card("Hello from Web Awesome") ) ) server <- function(input, output, session) {} shinyApp(ui, server) ``` `webawesomePage()` is especially useful when you want a small, explicit page helper rather than composing your own ``, `
`, and `` scaffolding manually. ## A slightly richer page The page helper works naturally with generated components and package-level layout helpers together: ```{r wa-page-richer, eval = FALSE} library(shiny) library(shiny.webawesome) ui <- webawesomePage( title = "Page example", wa_container( class = "wa-stack", style = "max-width: 32rem; margin: 2rem auto;", wa_card("Top card"), wa_button( "primary_action", "Continue", appearance = "filled", style = "width: 10rem;" ), wa_card("Bottom card") ) ) server <- function(input, output, session) {} shinyApp(ui, server) ``` # `wa_container()` `wa_container()` creates a plain `