Switch

Description

Create an on and off toggle with a label. It submits like a checkbox.

Usage

bc_switch(
  id,
  label,
  ...,
  size = "default",
  checked = FALSE,
  disabled = FALSE,
  invalid = FALSE,
  description = NULL,
  name = id
)

Arguments

Argument Description
id String. The input ID.
label String or tag. The label.
... Extra tag attributes for the switch.
size String. "default" or "sm".
checked Bool. Whether the box starts checked. Defaults to FALSE.
disabled Bool. Whether the box is disabled. Defaults to FALSE.
invalid Bool. Whether to show the invalid state. Defaults to FALSE.
description String or tag. Helper text shown under the label.
name String. The input name. Defaults to id.

Value

An htmltools tag.

Examples

bc_switch("airplane-mode", "Airplane Mode")

bc_switch(
  "focus-mode",
  "Share across devices",
  checked = TRUE,
  description = "Focus is shared across devices."
)

Focus is shared across devices.