selectizeInputWithButtons: selectizeInput with buttons and validation utilities

Description Usage Arguments See Also Examples

View source: R/selectizeInputWithButtons.R

Description

selectizeInput with buttons and validation utilities

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
selectizeInputWithButtons(
  inputId,
  label,
  ...,
  options = NULL,
  container_id = NULL,
  help_id = NULL,
  label_title = NULL,
  btn_titletips = TRUE,
  btn_placement = NULL,
  hide_btns = FALSE
)

Arguments

inputId

The input slot that will be used to access the value.

label

Display label for the control, or NULL for no label.

...

One or more actionButton's to appear to right of input element.

options

A list of options. See the documentation of selectize.js for possible options (character option values inside base::I() will be treated as literal JavaScript code; see renderDataTable() for details).

container_id

id for outer div (optional). Can use e.g. to add 'has-error' class to style inputs with shinyjs::addClass.

help_id

id for span with class 'help-block' below input (optional). Can be used for add error message with shinyjs::html.

label_title

Optional text to appear in info icon tooltip. Used to provide information to user about input.

btn_titletips

if TRUE (default), converts title attributes of actionButtons into tooltips.

btn_placement

Where the actionButton tooltips should appear (top, bottom, left, right). Defaults to 'right' for dropdown buttons and 'bottom' for all others.

hide_btns

If TRUE styling is adjusted so that all buttons are initially hidden. Can unhide buttons using toggleSelectizeButtons.

See Also

selectizeInput, html, addClass, toggleSelectizeButtons.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
library(shiny)
library(shinypanel)

ui <- fluidPage(
  div(class = 'row',
      div(class = 'col-sm-12 col-lg-6',
          div(class = 'well-form',
              textAreaInputWithButtons(
                inputId = 'text',
                label = 'Type something:',
                actionButton(
                  'btn3',
                  '',
                  icon('plus', 'fa-fw'),
                  title = 'Click to add something'
                )
              ),
              selectizeInputWithButtons(
                inputId = 'selection',
                label = 'Select something:',
                label_title = 'Information about input',
                actionButton(
                  'btn1',
                  '',
                  icon('tag', 'fa-fw'),
                  title = 'this does something'
                ),
                actionButton(
                  'btn2',
                  '',
                  icon('chevron-right', 'fa-fw'),
                  title = 'this does something else'
                ),
                options = list(multiple = TRUE)
              )
          )
      )
  )
)


server <- function(input, output, session) {

  choices <- reactive({
    paste('Long Option', 1:5)
  })

  observe({
    updateSelectizeInput(session, 'selection', choices = choices())
  })
}

# shinyApp(ui, server)

shinypanel documentation built on Jan. 7, 2021, 9:07 a.m.