R/wa_radio.R

Defines functions wa_radio

Documented in wa_radio

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

#' Create a `wa-radio` component
#'
#' Generated wrapper for the Web Awesome `wa-radio` 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 value String. The radio's value. When selected, the radio group
#' will receive this value.
#' @param disabled Boolean. Default: `FALSE`. Disables the radio.
#' @param name String. Default: `null`. The name of the input, submitted
#' as a name/value pair with form data.
#' @param appearance Enumerated string. Allowed values: `button`,
#' `default`. Default: `default`. The radio's visual appearance.
#' @param custom_error String. Default: `null`. Optional Web Awesome
#' attribute.
#' @param dir String. Optional Web Awesome attribute.
#' @param lang String. Optional Web Awesome attribute.
#' @param size Enumerated string. Allowed values: `large`, `medium`,
#' `small`. The radio's size. When used inside a radio group, the size
#' will be determined by the radio group's size, which will override this
#' attribute.
#'
#' @section Shiny Bindings:
#' None.
#'
#' @return An HTML tag for the component.
#'
#' @export
wa_radio <- function(
  ...,
  id = NULL,
  class = NULL,
  style = NULL,
  value = NULL,
  disabled = NULL,
  name = NULL,
  appearance = NULL,
  custom_error = NULL,
  dir = NULL,
  lang = NULL,
  size = NULL
) {
  children <- list(...)

  if (!is.null(appearance)) {
    appearance <- .wa_match_arg(
      appearance,
      "appearance",
      c(
        "button",
        "default"
      )
    )
  }

  if (!is.null(size)) {
    size <- .wa_match_arg(
      size,
      "size",
      c(
        "large",
        "medium",
        "small"
      )
    )
  }

  attrs <- .wa_normalize_attrs(
    list(
      "id" = id,
      "class" = class,
      "style" = style,
      "value" = value,
      "disabled" = disabled,
      "name" = name,
      "appearance" = appearance,
      "custom-error" = custom_error,
      "dir" = dir,
      "lang" = lang,
      "size" = size
    ),
    boolean_names = c("disabled"),
    boolean_arg_names = c("disabled" = "disabled")
  )

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