R/wa_page.R

Defines functions wa_page

Documented in wa_page

# Generated by tools/generate_components.R. Do not edit by hand.
# nolint start: object_usage_linter.

#' Create a `wa-page` component
#'
#' Generated wrapper for the Web Awesome `wa-page` component.
#' Generated from Web Awesome metadata.
#'
#' @param ... Child content for the component's default slot.
#' @param id Optional DOM id attribute for HTML, CSS, and JS targeting.
#' @param class Optional CSS class string.
#' @param style Optional inline CSS style string.
#' @param dir String. Optional Web Awesome attribute.
#' @param disable_navigation_toggle Boolean. Default: `FALSE`. Determines
#' whether or not to hide the default hamburger button. This will
#' automatically flip to "TRUE" if you add an element with
#' `data-toggle-nav` anywhere in the element light DOM. Generally this
#' will be set for you and you don't need to do anything, unless you're
#' using SSR, in which case you should set this manually for initial page
#' loads.
#' @param lang String. Optional Web Awesome attribute.
#' @param mobile_breakpoint String. Default: `768px`. At what page width
#' to hide the "navigation" slot and collapse into a hamburger button.
#' Accepts both numbers (interpreted as px) and CSS lengths (e.g. `50em`),
#' which are resolved based on the root element.
#' @param nav_open Boolean. Default: `FALSE`. Whether or not the
#' navigation drawer is open. Note, the navigation drawer is only "open"
#' on mobile views.
#' @param navigation_placement Enumerated string. Allowed values: `end`,
#' `start`. Default: `start`. Where to place the navigation when in the
#' mobile viewport.
#' @param view Enumerated string. Allowed values: `desktop`, `mobile`.
#' Default: `desktop`. The view is a reflection of the "mobileBreakpoint",
#' when the page is larger than the `mobile-breakpoint` (768px by
#' default), it is considered to be a "desktop" view. The view is merely a
#' way to distinguish when to show/hide the navigation. You can use
#' additional media queries to make other adjustments to content as
#' necessary. The default is "desktop" because the "mobile navigation
#' drawer" isn't accessible via SSR due to drawer requiring JS.
#' @param aside Content to be shown on the right side of the page.
#' Typically contains a table of contents, ads, etc. This section "sticks"
#' to the top as the page scrolls.
#' @param banner The banner that gets display above the header. The banner
#' will not be shown if no content is provided.
#' @param footer The content to display in the footer. This is always
#' displayed underneath the viewport so will always make the page
#' "scrollable".
#' @param header The header to display at the top of the page. If a banner
#' is present, the header will appear below the banner. The header will
#' not be shown if there is no content.
#' @param main_footer Footer to display inline below the main content.
#' @param main_header Header to display inline above the main content.
#' @param menu The left side of the page. If you slot an element in here,
#' you will override the default `navigation` slot and will be handling
#' navigation on your own. This also will not disable the fallback
#' behavior of the navigation button. This section "sticks" to the top as
#' the page scrolls.
#' @param navigation The main content to display in the navigation area.
#' This is displayed on the left side of the page, if `menu` is not used.
#' This section "sticks" to the top as the page scrolls.
#' @param navigation_footer The footer for a navigation area. On mobile
#' this will be the footer for `<wa-drawer>`.
#' @param navigation_header The header for a navigation area. On mobile
#' this will be the header for `<wa-drawer>`.
#' @param navigation_toggle Use this slot to slot in your own button +
#' icon for toggling the navigation drawer. By default it is a
#' `<wa-button>` + a 3 bars `<wa-icon>`
#' @param navigation_toggle_icon Use this to slot in your own icon for
#' toggling the navigation drawer. By default it is 3 bars `<wa-icon>`.
#' @param skip_to_content The "skip to content" slot. You can override
#' this If you would like to override the `Skip to content` button and add
#' additional "Skip to X", they can be inserted here.
#' @param subheader A subheader to display below the `header`. This is a
#' good place to put things like breadcrumbs.
#'
#' @section Shiny Bindings:
#' None.
#'
#' @return An HTML tag for the component.
#'
#' @export
wa_page <- function(
  ...,
  id = NULL,
  class = NULL,
  style = NULL,
  dir = NULL,
  disable_navigation_toggle = NULL,
  lang = NULL,
  mobile_breakpoint = NULL,
  nav_open = NULL,
  navigation_placement = NULL,
  view = NULL,
  aside = NULL,
  banner = NULL,
  footer = NULL,
  header = NULL,
  main_footer = NULL,
  main_header = NULL,
  menu = NULL,
  navigation = NULL,
  navigation_footer = NULL,
  navigation_header = NULL,
  navigation_toggle = NULL,
  navigation_toggle_icon = NULL,
  skip_to_content = NULL,
  subheader = NULL
) {
  children <- list(...)
  children <- c(
    children,
    list(
      .wa_slot(aside, "aside")
    )
  )
  children <- c(
    children,
    list(
      .wa_slot(banner, "banner")
    )
  )
  children <- c(
    children,
    list(
      .wa_slot(footer, "footer")
    )
  )
  children <- c(
    children,
    list(
      .wa_slot(header, "header")
    )
  )
  children <- c(
    children,
    list(
      .wa_slot(main_footer, "main-footer")
    )
  )
  children <- c(
    children,
    list(
      .wa_slot(main_header, "main-header")
    )
  )
  children <- c(
    children,
    list(
      .wa_slot(menu, "menu")
    )
  )
  children <- c(
    children,
    list(
      .wa_slot(navigation, "navigation")
    )
  )
  children <- c(
    children,
    list(
      .wa_slot(navigation_footer, "navigation-footer")
    )
  )
  children <- c(
    children,
    list(
      .wa_slot(navigation_header, "navigation-header")
    )
  )
  children <- c(
    children,
    list(
      .wa_slot(navigation_toggle, "navigation-toggle")
    )
  )
  children <- c(
    children,
    list(
      .wa_slot(navigation_toggle_icon, "navigation-toggle-icon")
    )
  )
  children <- c(
    children,
    list(
      .wa_slot(skip_to_content, "skip-to-content")
    )
  )
  children <- c(
    children,
    list(
      .wa_slot(subheader, "subheader")
    )
  )

  if (!is.null(navigation_placement)) {
    navigation_placement <- .wa_match_arg(
      navigation_placement,
      "navigation_placement",
      c(
        "end",
        "start"
      )
    )
  }

  if (!is.null(view)) {
    view <- .wa_match_arg(
      view,
      "view",
      c(
        "desktop",
        "mobile"
      )
    )
  }

  attrs <- .wa_normalize_attrs(
    list(
      "id" = id,
      "class" = class,
      "style" = style,
      "dir" = dir,
      "disable-navigation-toggle" = disable_navigation_toggle,
      "lang" = lang,
      "mobile-breakpoint" = mobile_breakpoint,
      "nav-open" = nav_open,
      "navigation-placement" = navigation_placement,
      "view" = view
    ),
    boolean_names = c("disable-navigation-toggle", "nav-open"),
    boolean_arg_names = c(
      "disable-navigation-toggle" = "disable_navigation_toggle",
      "nav-open" = "nav_open"
    )
  )

  do.call(
    .wa_component,
    c(
      list("wa-page", .attrs = attrs),
      children
    )
  )
}
# nolint end

Try the shiny.webawesome package in your browser

Any scripts or data that you put into this service are public.

shiny.webawesome documentation built on April 22, 2026, 1:09 a.m.