R/wa_tab_group.R

Defines functions wa_tab_group

Documented in wa_tab_group

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

#' Create a `wa-tab-group` component
#'
#' Generated wrapper for the Web Awesome `wa-tab-group` component. When
#' used as a Shiny input, `input$<input_id>` reflects the component's
#' current semantic `active` state. The Shiny value is returned as a
#' character string.
#' Generated from Web Awesome metadata.
#'
#' @param ... Child content for the component's default slot.
#' @param input_id Shiny input id for the component. This is also used as
#' the rendered DOM `id` attribute.
#' @param class Optional CSS class string.
#' @param style Optional inline CSS style string.
#' @param activation Enumerated string. Allowed values: `auto`, `manual`.
#' Default: `auto`. When set to auto, navigating tabs with the arrow keys
#' will instantly show the corresponding tab panel. When set to manual,
#' the tab will receive focus but will not show until the user presses
#' spacebar or enter.
#' @param active String. Default: `""`. Sets the active tab.
#' @param dir String. Optional Web Awesome attribute.
#' @param lang String. Optional Web Awesome attribute.
#' @param placement Enumerated string. Allowed values: `bottom`, `end`,
#' `start`, `top`. Default: `top`. The placement of the tabs.
#' @param without_scroll_controls Boolean. Default: `FALSE`. Disables the
#' scroll arrows that appear when tabs overflow.
#' @param nav Used for grouping tabs in the tab group. Must be `<wa-tab>`
#' elements. Note that `<wa-tab>` will set this slot on itself
#' automatically.
#'
#' @section Shiny Bindings:
#' `input$<input_id>` reflects the component's current semantic `active`
#' state. The Shiny value is returned as a character string.
#'
#' @return An HTML tag for the component.
#'
#' @export
wa_tab_group <- function(
  input_id,
  ...,
  class = NULL,
  style = NULL,
  activation = NULL,
  active = NULL,
  dir = NULL,
  lang = NULL,
  placement = NULL,
  without_scroll_controls = NULL,
  nav = NULL
) {
  children <- list(...)
  children <- c(
    children,
    list(
      .wa_slot(nav, "nav")
    )
  )

  if (!is.null(activation)) {
    activation <- .wa_match_arg(
      activation,
      "activation",
      c(
        "auto",
        "manual"
      )
    )
  }

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

  attrs <- .wa_normalize_attrs(
    list(
      "id" = input_id,
      "class" = class,
      "style" = style,
      "activation" = activation,
      "active" = active,
      "dir" = dir,
      "lang" = lang,
      "placement" = placement,
      "without-scroll-controls" = without_scroll_controls
    ),
    boolean_names = c("without-scroll-controls"),
    boolean_arg_names = c("without-scroll-controls" = "without_scroll_controls")
  )

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