R/wa_option.R

Defines functions wa_option

Documented in wa_option

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

#' Create a `wa-option` component
#'
#' Generated wrapper for the Web Awesome `wa-option` 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. Default: `""`. The option's value. When selected,
#' the containing form control will receive this value. The value must be
#' unique from other options in the same group. Values may not contain
#' spaces, as spaces are used as delimiters when listing multiple values.
#' @param disabled Boolean. Default: `FALSE`. Draws the option in a
#' disabled state, preventing selection.
#' @param label String. The option’s plain text label. Usually
#' automatically generated, but can be useful to provide manually for
#' cases involving complex content.
#' @param dir String. Optional Web Awesome attribute.
#' @param lang String. Optional Web Awesome attribute.
#' @param selected Boolean. Default: `FALSE`. Selects an option initially.
#' This wrapper argument sets the HTML `selected` attribute, which maps to
#' the component's `defaultSelected` field/property.
#' @param end An element, such as `<wa-icon>`, placed after the label.
#' @param start An element, such as `<wa-icon>`, placed before the label.
#'
#' @section Shiny Bindings:
#' None.
#'
#' @return An HTML tag for the component.
#'
#' @export
wa_option <- function(
  ...,
  id = NULL,
  class = NULL,
  style = NULL,
  value = NULL,
  disabled = NULL,
  label = NULL,
  dir = NULL,
  lang = NULL,
  selected = NULL,
  end = NULL,
  start = NULL
) {
  children <- list(...)
  children <- c(
    children,
    list(
      .wa_slot(end, "end")
    )
  )
  children <- c(
    children,
    list(
      .wa_slot(start, "start")
    )
  )

  attrs <- .wa_normalize_attrs(
    list(
      "id" = id,
      "class" = class,
      "style" = style,
      "value" = value,
      "disabled" = disabled,
      "label" = label,
      "dir" = dir,
      "lang" = lang,
      "selected" = selected
    ),
    boolean_names = c("disabled", "selected"),
    boolean_arg_names = c(
      "disabled" = "disabled",
      "selected" = "selected"
    )
  )

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