reactCheckboxesInput {reactCheckbox}R Documentation

Checkbox group input

Description

Create a checkbox group input for usage in Shiny.

Usage

reactCheckboxesInput(
  inputId,
  checkboxes,
  headLabel = "Check all",
  headClass = "",
  styles = NULL,
  theme = "material"
)

Arguments

inputId

the id that will be used to get the values in Shiny

checkboxes

a list of checkboxes defined with the checkbox function

headLabel

the label for the head checkbox

headClass

a CSS class for the head checkbox

styles

a named list of styles created with the checkboxStyle function; the names denote the CSS classes

theme

the theme, "bootstrap", "fancy", or "material"

Value

A shiny.tag.list object to be included in a Shiny UI.

Examples

library(shiny)
library(htmltools)
library(reactCheckbox)

ui <- fluidPage(
  reactCheckboxesInput(
    "iris",
    list(
      checkbox("Sepal length", FALSE),
      checkbox("Sepal width", FALSE),
      checkbox("Petal length", FALSE),
      checkbox("Petal width", FALSE)
    ),
    headLabel = tags$span(
      "Make a choice", style = "font-size: 1.8rem; font-style: italic;"
    ),
    headClass = "custom",
    theme = "material",
    styles = list(
      "custom" = checkboxStyle(
        checked = css(
          background.color = "darkred"
        ),
        checked_hover = css(
          background.color = "maroon"
        ),
        unchecked = css(
          background.color = "darkorange"
        ),
        unchecked_hover = css(
          background.color = "orange"
        ),
        indeterminate = css(
          background.color = "gold"
        ),
        indeterminate_hover = css(
          background.color = "yellow"
        )
      )
    )
  )
)

server <- function(input, output, session) {
  observe({
    print(input[["iris"]])
  })
}

if(interactive()) {
  shinyApp(ui, server)
}

[Package reactCheckbox version 1.0.0 Index]