Skip to contents

Adds a set of checkbox, radio buttons, or switches to a website.

Usage

input_checkbox(label, options, default = "all", display = options,
  id = label, ..., note = NULL, variable = NULL, dataset = NULL,
  depends = NULL, multi = TRUE, as.switch = FALSE)

Arguments

label

Label of the input for the user.

options

A vector of options, the name of a variable from which to pull levels, or either "datasets" or "variables" to select names of datasets or variables.

default

A vector of items to check by default (or "all" or "none") if multi is TRUE, or the option to select by default.

display

A display version of the options.

id

Unique id of the element to be created.

...

Additional attributes to set on the element.

note

Text to display as a tooltip for the input.

variable

The name of a variable from which to get levels (overwritten by depends).

dataset

The name of an included dataset, where variable should be looked for; only applies when there are multiple datasets with the same variable name.

depends

The id of another input on which the options depend; this will take president over dataset and variable, depending on this type of input depends points to.

multi

Logical; if FALSE, only one option can be selected at a time, turning the checkboxes into radio buttons.

as.switch

Logical; if TRUE, displays checkboxes or radio buttons as switches.

Value

A character vector of the contents to be added.

See also

For a single switch or checkbox, use input_switch.

Examples

if (FALSE) {
input_checkbox("Label", c("a", "b", "c"))
}