R/wa_format_number.R

Defines functions wa_format_number

Documented in wa_format_number

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

#' Create a `wa-format-number` component
#'
#' Generated wrapper for the Web Awesome `wa-format-number` 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.
#' @param currency String. Default: `USD`. The ISO 4217 currency code to
#' use when formatting.
#' @param currency_display Enumerated string. Allowed values: `code`,
#' `name`, `narrowSymbol`, `symbol`. Default: `symbol`. How to display the
#' currency.
#' @param dir String. Optional Web Awesome attribute.
#' @param lang String. Optional Web Awesome attribute.
#' @param maximum_fraction_digits Number. The maximum number of fraction
#' digits to use. Possible values are 0-100.
#' @param maximum_significant_digits Number. The maximum number of
#' significant digits to use,. Possible values are 1-21.
#' @param minimum_fraction_digits Number. The minimum number of fraction
#' digits to use. Possible values are 0-100.
#' @param minimum_integer_digits Number. The minimum number of integer
#' digits to use. Possible values are 1-21.
#' @param minimum_significant_digits Number. The minimum number of
#' significant digits to use. Possible values are 1-21.
#' @param type Enumerated string. Allowed values: `currency`, `decimal`,
#' `percent`. Default: `decimal`. The formatting style to use.
#' @param without_grouping Boolean. Default: `FALSE`. Turns off grouping
#' separators.
#'
#' @section Shiny Bindings:
#' None.
#'
#' @return An HTML tag for the component.
#'
#' @export
wa_format_number <- function(
  ...,
  id = NULL,
  class = NULL,
  style = NULL,
  value = NULL,
  currency = NULL,
  currency_display = NULL,
  dir = NULL,
  lang = NULL,
  maximum_fraction_digits = NULL,
  maximum_significant_digits = NULL,
  minimum_fraction_digits = NULL,
  minimum_integer_digits = NULL,
  minimum_significant_digits = NULL,
  type = NULL,
  without_grouping = NULL
) {
  children <- list(...)

  if (!is.null(currency_display)) {
    currency_display <- .wa_match_arg(
      currency_display,
      "currency_display",
      c(
        "code",
        "name",
        "narrowSymbol",
        "symbol"
      )
    )
  }

  if (!is.null(type)) {
    type <- .wa_match_arg(
      type,
      "type",
      c(
        "currency",
        "decimal",
        "percent"
      )
    )
  }

  attrs <- .wa_normalize_attrs(
    list(
      "id" = id,
      "class" = class,
      "style" = style,
      "value" = value,
      "currency" = currency,
      "currency-display" = currency_display,
      "dir" = dir,
      "lang" = lang,
      "maximum-fraction-digits" = maximum_fraction_digits,
      "maximum-significant-digits" = maximum_significant_digits,
      "minimum-fraction-digits" = minimum_fraction_digits,
      "minimum-integer-digits" = minimum_integer_digits,
      "minimum-significant-digits" = minimum_significant_digits,
      "type" = type,
      "without-grouping" = without_grouping
    ),
    boolean_names = c("without-grouping"),
    boolean_arg_names = c("without-grouping" = "without_grouping")
  )

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