R/wa_card.R

Defines functions wa_card

Documented in wa_card

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

#' Create a `wa-card` component
#'
#' Generated wrapper for the Web Awesome `wa-card` 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 appearance Enumerated string. Allowed values: `accent`,
#' `filled`, `filled-outlined`, `outlined`, `plain`. Default: `outlined`.
#' The card's visual appearance.
#' @param dir String. Optional Web Awesome attribute.
#' @param lang String. Optional Web Awesome attribute.
#' @param orientation Enumerated string. Allowed values: `horizontal`,
#' `vertical`. Default: `vertical`. Renders the card's orientation *
#' @param with_footer Boolean. Default: `FALSE`. Only required for SSR.
#' Set to `TRUE` if you're slotting in a `footer` element so the
#' server-rendered markup includes the footer before the component
#' hydrates on the client.
#' @param with_header Boolean. Default: `FALSE`. Only required for SSR.
#' Set to `TRUE` if you're slotting in a `header` element so the
#' server-rendered markup includes the header before the component
#' hydrates on the client.
#' @param with_media Boolean. Default: `FALSE`. Only required for SSR. Set
#' to `TRUE` if you're slotting in a `media` element so the
#' server-rendered markup includes the media before the component hydrates
#' on the client.
#' @param actions An optional actions section to render at the end for the
#' horizontal card.
#' @param footer An optional footer for the card.
#' @param footer_actions An optional actions section to render in the
#' footer of the vertical card.
#' @param header An optional header for the card.
#' @param header_actions An optional actions section to render in the
#' header of the vertical card.
#' @param media An optional media section to render at the start of the
#' card.
#'
#' @section Shiny Bindings:
#' None.
#'
#' @return An HTML tag for the component.
#'
#' @export
wa_card <- function(
  ...,
  id = NULL,
  class = NULL,
  style = NULL,
  appearance = NULL,
  dir = NULL,
  lang = NULL,
  orientation = NULL,
  with_footer = NULL,
  with_header = NULL,
  with_media = NULL,
  actions = NULL,
  footer = NULL,
  footer_actions = NULL,
  header = NULL,
  header_actions = NULL,
  media = NULL
) {
  children <- list(...)
  children <- c(
    children,
    list(
      .wa_slot(actions, "actions")
    )
  )
  children <- c(
    children,
    list(
      .wa_slot(footer, "footer")
    )
  )
  children <- c(
    children,
    list(
      .wa_slot(footer_actions, "footer-actions")
    )
  )
  children <- c(
    children,
    list(
      .wa_slot(header, "header")
    )
  )
  children <- c(
    children,
    list(
      .wa_slot(header_actions, "header-actions")
    )
  )
  children <- c(
    children,
    list(
      .wa_slot(media, "media")
    )
  )

  if (!is.null(appearance)) {
    appearance <- .wa_match_arg(
      appearance,
      "appearance",
      c(
        "accent",
        "filled",
        "filled-outlined",
        "outlined",
        "plain"
      )
    )
  }

  if (!is.null(orientation)) {
    orientation <- .wa_match_arg(
      orientation,
      "orientation",
      c(
        "horizontal",
        "vertical"
      )
    )
  }

  attrs <- .wa_normalize_attrs(
    list(
      "id" = id,
      "class" = class,
      "style" = style,
      "appearance" = appearance,
      "dir" = dir,
      "lang" = lang,
      "orientation" = orientation,
      "with-footer" = with_footer,
      "with-header" = with_header,
      "with-media" = with_media
    ),
    boolean_names = c(
      "with-footer",
      "with-header",
      "with-media"
    ),
    boolean_arg_names = c(
      "with-footer" = "with_footer",
      "with-header" = "with_header",
      "with-media" = "with_media"
    )
  )

  do.call(
    .wa_component,
    c(
      list("wa-card", .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.