Getting started

Checkbox inputs may have a single possible value.

checkboxInput(
  id = NULL,
  choices = "Choice 1",
  selected = "Choice 1"
)

You may also specify multiple possible values.

checkboxInput(
  id = NULL,
  choices = c("Choice 1", "Choice 2", "Choice 3"),
  selected = c("Choice 1", "Choice 2")
)

Layout

While checkbox input choices are typically laid out vertically you can lay out the choices horizontally with inline = TRUE.

checkboxInput(
  id = NULL,
  choices = c("Choice 1", "Choice 2", "Choice 3"),
  inline = TRUE  # <-
)

Switch variant

The switch input functions identical to the checkbox input with a different appearance.

switchInput(
  id = NULL,
  choices = c("Toggle 1", "Toggle 2", "Toggle 3"),
  selected = "Toggle 2"
)

Background color

Changing the background color of a checkbox or switch input will modify the background color of the selected choices.

checkboxInput(
  .style %>%
    background("warning"),
  id = NULL,
  choices = c("Choice 1", "Choice 2"),
  selected = c("Choice 1", "Choice 2")
)
switchInput(
  .style %>%
    background("success"),
  id = NULL,
  choices = c("Toggle 1", "Toggle 2"),
  selected = "Toggle 1"
)

Labelling

formGroup(
  label = "Label",
  checkboxInput(
    id = NULL,
    choices = c("Choice 1", "Choice 2")
  ),
  help = "Help text for the input"
)


nteetor/dull documentation built on June 10, 2022, 11:30 a.m.