Nothing
# Generated by tools/generate_components.R. Do not edit by hand.
# nolint start: object_usage_linter.
#' Create a `wa-switch` component
#'
#' Generated wrapper for the Web Awesome `wa-switch` component. When used
#' as a Shiny input, `input$<input_id>` reflects the component's current
#' `value` value. The Shiny value is returned as a logical value.
#' 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 value String. The value of the switch, submitted as a name/value
#' pair with form data.
#' @param checked Boolean. Default: `FALSE`. The default value of the form
#' control. Primarily used for resetting the form control. This wrapper
#' argument sets the HTML `checked` attribute, which maps to the
#' component's `defaultChecked` field/property rather than its live
#' `checked` property.
#' @param disabled Boolean. Default: `FALSE`. Disables the switch.
#' @param hint String. Default: `""`. The switch's hint. If you need to
#' display HTML, use the `hint` slot instead.
#' @param name String. Default: `null`. The name of the switch, submitted
#' as a name/value pair with form data.
#' @param custom_error String. Default: `null`. Optional Web Awesome
#' attribute.
#' @param dir String. Optional Web Awesome attribute.
#' @param lang String. Optional Web Awesome attribute.
#' @param required Boolean. Default: `FALSE`. Makes the switch a required
#' field.
#' @param size Enumerated string. Allowed values: `large`, `medium`,
#' `small`. Default: `medium`. The switch's size.
#' @param title String. Default: `""`. Optional Web Awesome attribute.
#' @param with_hint Boolean. Default: `FALSE`. Only required for SSR. Set
#' to `TRUE` if you're slotting in a `hint` element so the server-rendered
#' markup includes the hint before the component hydrates on the client.
#' @param hint_slot Text that describes how to use the switch.
#' Alternatively, you can use the `hint` attribute.
#'
#' @section Shiny Bindings:
#' `input$<input_id>` reflects the component's current `value` value. The
#' Shiny value is returned as a logical value.
#'
#' @return An HTML tag for the component.
#'
#' @export
wa_switch <- function(
input_id,
...,
class = NULL,
style = NULL,
value = NULL,
checked = NULL,
disabled = NULL,
hint = NULL,
name = NULL,
custom_error = NULL,
dir = NULL,
lang = NULL,
required = NULL,
size = NULL,
title = NULL,
with_hint = NULL,
hint_slot = NULL
) {
children <- list(...)
children <- c(
children,
list(
.wa_slot(hint_slot, "hint")
)
)
if (!is.null(size)) {
size <- .wa_match_arg(
size,
"size",
c(
"large",
"medium",
"small"
)
)
}
attrs <- .wa_normalize_attrs(
list(
"id" = input_id,
"class" = class,
"style" = style,
"value" = value,
"checked" = checked,
"disabled" = disabled,
"hint" = hint,
"name" = name,
"custom-error" = custom_error,
"dir" = dir,
"lang" = lang,
"required" = required,
"size" = size,
"title" = title,
"with-hint" = with_hint
),
boolean_names = c(
"checked",
"disabled",
"required",
"with-hint"
),
boolean_arg_names = c(
"checked" = "checked",
"disabled" = "disabled",
"required" = "required",
"with-hint" = "with_hint"
)
)
do.call(
.wa_component,
c(
list("wa-switch", .attrs = attrs),
children
)
)
}
# nolint end
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.