Skip to contents

A shadcn switch (toggle). input$<inputId> is a logical.

Usage

shad_switch(
  inputId,
  label = NULL,
  value = FALSE,
  disabled = FALSE,
  description = NULL,
  class = NULL,
  ...
)

Arguments

inputId

Input id.

label

Optional label shown next to the switch.

value

Initial logical value.

disabled

If TRUE, disables the control.

description

Optional help text below the row.

class

Extra CSS classes.

...

Extra attributes on the switch button.

Value

A switch row tag.

Examples

shad_switch("wifi", "Wi-Fi", value = TRUE)
#> <div class="shad-switch-row">
#>   <button type="button" class="shad-switch" data-shad="switch" role="switch" data-state="checked" id="wifi">
#>     <span class="shad-switch__thumb" aria-hidden="true"></span>
#>   </button>
#>   <label class="shad-label" for="wifi">Wi-Fi</label>
#> </div>