dccChecklist: Checklist component

Description Usage Arguments Value Examples

View source: R/dccChecklist.R

Description

Checklist is a component that encapsulates several checkboxes. The values and labels of the checklist are specified in the 'options' property and the checked items are specified with the 'value' property. Each checkbox is rendered as an input with a surrounding label.

Usage

1
2
3
4
5
dccChecklist(id=NULL, options=NULL, value=NULL, className=NULL,
style=NULL, inputStyle=NULL, inputClassName=NULL,
labelStyle=NULL, labelClassName=NULL, loading_state=NULL,
persistence=NULL, persisted_props=NULL,
persistence_type=NULL)

Arguments

id

Character. The ID of this component, used to identify dash components in callbacks. The ID needs to be unique across all of the components in an app.

options

List of lists containing elements 'label', 'value', 'disabled'. those elements have the following types: - label (character | numeric; required): the checkbox's label - value (character | numeric; required): the value of the checkbox. this value corresponds to the items specified in the 'value' property. - disabled (logical; optional): if true, this checkbox is disabled and can't be clicked on.s. An array of options

value

List of character | numerics. The currently selected value

className

Character. The class of the container (div)

style

Named list. The style of the container (div)

inputStyle

Named list. The style of the <input> checkbox element

inputClassName

Character. The class of the <input> checkbox element

labelStyle

Named list. The style of the <label> that wraps the checkbox input and the option's label

labelClassName

Character. The class of the <label> that wraps the checkbox input and the option's label

loading_state

Lists containing elements 'is_loading', 'prop_name', 'component_name'. those elements have the following types: - is_loading (logical; optional): determines if the component is loading or not - prop_name (character; optional): holds which property is loading - component_name (character; optional): holds the name of the component that is loading. Object that holds the loading state object coming from dash-renderer

persistence

Logical | character | numeric. Used to allow user interactions in this component to be persisted when the component - or the page - is refreshed. If 'persisted' is truthy and hasn't changed from its previous value, a 'value' that the user has changed while using the app will keep that change, as long as the new 'value' also matches what was given originally. Used in conjunction with 'persistence_type'.

persisted_props

List of a value equal to: 'value's. Properties whose user interactions will persist after refreshing the component or the page. Since only 'value' is allowed this prop can normally be ignored.

persistence_type

A value equal to: 'local', 'session', 'memory'. Where persisted user changes will be stored: memory: only kept in memory, reset on page refresh. local: window.localStorage, data is kept after the browser quit. session: window.sessionStorage, data is cleared once the browser quit.

Value

named list of JSON elements corresponding to React.js properties and their values

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
if (interactive() && require(dash)) {
  library(dash)
  library(dashHtmlComponents)
  library(dashCoreComponents)

  app <- Dash$new()

  app$layout(
    dccChecklist(
      id = "checklist-input",
      options=list(
        list("label" = "New York City", "value" = "NYC"),
        list("label" = "Montreal", "value" = "MTL"),
        list("label" = "San Francisco", "value" = "SF")
       ),
      value=list("MTL", "SF")
     )
  )

  app$run_server()
}

Example output



dashCoreComponents documentation built on July 1, 2020, 8:20 p.m.