sortable package enables drag-and-drop behaviour in your Shiny
apps. It does this by exposing the functionality of the
as an htmlwidget in R, so you can use this in
Shiny apps and widgets,
learnr tutorials as well as R Markdown. In
addition, provides a custom
learnr question type -
that allows ranking questions with drag-and-drop.
You can install the released version of sortable from CRAN with:
And the development version from GitHub with:
# install.packages("remotes") remotes::install_github("rstudio/sortable")
You can create a drag-and-drop input object in Shiny, using the
#> Warning in file(con, "r"): file("") only supports open = "w+" and open = "w+b": #> using the former #> Warning in knitr::read_chunk(system.file("shiny-examples/rank_list/app.R", : #> code is empty
With a bucket list you can have more than one rank lists in a single object. This can be useful for bucketing tasks, e.g. asking your students to classify objects into multiple categories.
#> Warning in file(con, "r"): file("") only supports open = "w+" and open = "w+b": #> using the former #> Warning in knitr::read_chunk(system.file("shiny-examples/bucket_list/app.R", : #> code is empty
Add drag-and-drop to any HTML element
You can also use
sortable_js() to drag and drop other widgets:
I learnt about the following related work after starting on
“The purpose of this add-in is to let you explore your data quickly to extract the information they hold. You can only create simple plots, you won’t be able to use custom scales and all the power of ggplot2.”
There is also the
Adds functionality to create drag and drop div elements in shiny.