Create a dropzone input

dropZoneInput(
  inputId,
  choices,
  presets = NULL,
  hidden = FALSE,
  placeholder = NULL,
  highlight = FALSE,
  multivalued = FALSE,
  selectable = FALSE,
  selectOnDrop = FALSE,
  togglevis = FALSE,
  togglelock = FALSE,
  removeOnSpill = TRUE,
  direction = "vertical",
  maxInput = Inf,
  replaceOnDrop = FALSE,
  flex = FALSE,
  server = NULL,
  ...
)

Arguments

inputId

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

choices

List of acceptable values with their associated labels. Note that the labels can be arbitrary HTML, as long as they are wrapped in a tagList.

presets

Array or list of preset values.

hidden

Should the selected items be hidden? This is useful to represent a reactive or event trigger.

placeholder

Insert placeholder text.

highlight

Highlights the container on dragover. Useful when hidden is active.

multivalued

Allow multiple items with the same value?

selectable

Are the items in this dropzone selectable? Default is false. Use Shiny input input$<inputId>_selected to access selected items.

selectOnDrop

Should new dropped items be automatically selected?

togglevis

Add an icon to allow toggling items between visible/invisible. Default is false. Use Shiny input input$<inputId>_invisible to access invisible items.

togglelock

Add an icon to allow toggling items between locked/unlocked. Locked items are not draggable. Default is false. Use Shiny input input$<inputId>_locked to access locked items.

removeOnSpill

Remove items when dragged outside dropzone? Default is true.

direction

Direction (horizontal or vertical) to consider when determining where an element would be dropped. Default is vertical.

maxInput

Maximum allowable dropped items.

replaceOnDrop

Replace item on drop when at maximum allowable items?

flex

Use flex container for dropzone. Items are set to wrap, and flex direction is given by the direction argument (defaults to vertical).

server

Function or function name as a string that will be used for server-side creation of UI for dropzone items. This is needed only when the dropzone items contain Shiny inputs and/or outputs. You must also include the dropZoneServer function in the server portion of your Shiny app.

...

Additional arguments passed along to tags$div, such as class

See also

Examples

dropZoneInput("dropzone", choices = list(one = "1", two = "2", three = "3", four = "4"))
#> <div id="dropzone" class="form-control ds-dropzone" data-select-on-drop="false" data-remove-on-spill="true" data-direction="vertical" data-max-input="Infinity" data-server="false"> #> <span class="ds-placeholder hidden"></span> #> <div class="ds-dropzone-options"> #> <div data-value="one" data-instance class="ds-dropoption">1</div> #> <div data-value="two" data-instance class="ds-dropoption">2</div> #> <div data-value="three" data-instance class="ds-dropoption">3</div> #> <div data-value="four" data-instance class="ds-dropoption">4</div> #> </div> #> </div>