R/wa_dropdown_item.R

Defines functions wa_dropdown_item

Documented in wa_dropdown_item

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

#' Create a `wa-dropdown-item` component
#'
#' Generated wrapper for the Web Awesome `wa-dropdown-item` 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. An optional value for the menu item. This is
#' useful for determining which item was selected when listening to the
#' dropdown's `wa-select` event.
#' @param checked Boolean. Default: `FALSE`. Set to TRUE to check the
#' dropdown item. Only valid when `type` is `checkbox`.
#' @param disabled Boolean. Default: `FALSE`. Disables the dropdown item.
#' @param dir String. Optional Web Awesome attribute.
#' @param lang String. Optional Web Awesome attribute.
#' @param submenu_open Boolean. Default: `FALSE`. Whether the submenu is
#' currently open.
#' @param type Enumerated string. Allowed values: `checkbox`, `normal`.
#' Default: `normal`. Set to `checkbox` to make the item a checkbox.
#' @param variant Enumerated string. Allowed values: `danger`, `default`.
#' Default: `default`. The type of menu item to render.
#' @param details Additional content or details to display after the
#' label.
#' @param icon An optional icon to display before the label.
#' @param submenu Submenu items, typically `<wa-dropdown-item>` elements,
#' to create a nested menu.
#'
#' @section Shiny Bindings:
#' None.
#'
#' @return An HTML tag for the component.
#'
#' @export
wa_dropdown_item <- function(
  ...,
  id = NULL,
  class = NULL,
  style = NULL,
  value = NULL,
  checked = NULL,
  disabled = NULL,
  dir = NULL,
  lang = NULL,
  submenu_open = NULL,
  type = NULL,
  variant = NULL,
  details = NULL,
  icon = NULL,
  submenu = NULL
) {
  children <- list(...)
  children <- c(
    children,
    list(
      .wa_slot(details, "details")
    )
  )
  children <- c(
    children,
    list(
      .wa_slot(icon, "icon")
    )
  )
  children <- c(
    children,
    list(
      .wa_slot(submenu, "submenu")
    )
  )

  if (!is.null(type)) {
    type <- .wa_match_arg(
      type,
      "type",
      c(
        "checkbox",
        "normal"
      )
    )
  }

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

  attrs <- .wa_normalize_attrs(
    list(
      "id" = id,
      "class" = class,
      "style" = style,
      "value" = value,
      "checked" = checked,
      "disabled" = disabled,
      "dir" = dir,
      "lang" = lang,
      "submenuOpen" = submenu_open,
      "type" = type,
      "variant" = variant
    ),
    boolean_names = c(
      "checked",
      "disabled",
      "submenuOpen"
    ),
    boolean_arg_names = c(
      "checked" = "checked",
      "disabled" = "disabled",
      "submenuOpen" = "submenu_open"
    )
  )

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