R/wa_format_bytes.R

Defines functions wa_format_bytes

Documented in wa_format_bytes

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

#' Create a `wa-format-bytes` component
#'
#' Generated wrapper for the Web Awesome `wa-format-bytes` 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 Number. Default: `0`. The number to format in bytes.
#' @param dir String. Optional Web Awesome attribute.
#' @param display Enumerated string. Allowed values: `long`, `narrow`,
#' `short`. Default: `short`. Determines how to display the result, e.g.
#' "100 bytes", "100 b", or "100b".
#' @param lang String. Optional Web Awesome attribute.
#' @param unit Enumerated string. Allowed values: `bit`, `byte`. Default:
#' `byte`. The type of unit to display.
#'
#' @section Shiny Bindings:
#' None.
#'
#' @return An HTML tag for the component.
#'
#' @export
wa_format_bytes <- function(
  ...,
  id = NULL,
  class = NULL,
  style = NULL,
  value = NULL,
  dir = NULL,
  display = NULL,
  lang = NULL,
  unit = NULL
) {
  children <- list(...)

  if (!is.null(display)) {
    display <- .wa_match_arg(
      display,
      "display",
      c(
        "long",
        "narrow",
        "short"
      )
    )
  }

  if (!is.null(unit)) {
    unit <- .wa_match_arg(
      unit,
      "unit",
      c(
        "bit",
        "byte"
      )
    )
  }

  attrs <- .wa_normalize_attrs(
    list(
      "id" = id,
      "class" = class,
      "style" = style,
      "value" = value,
      "dir" = dir,
      "display" = display,
      "lang" = lang,
      "unit" = unit
    ),
    boolean_names = character(),
    boolean_arg_names = NULL
  )

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