Custom Inputs Widgets for Shiny

Collection of custom input controls and user interface components for 'Shiny' applications. Give your applications a unique and colorful style !


Travis-CI Build Status AppVeyor build status version cranlogs cran checks Coverage Status

Overview

This package provide some custom widgets to pimp your shiny apps !

You can replace classical checkboxes with switch button, add colors to radio buttons and checkbox group, use buttons as radio or checkboxes. Each widget has an update method to change the value of an input from the server.

Installation :

# From CRAN
install.packages("shinyWidgets")
 
# From Github
# install.packages("devtools")
devtools::install_github("dreamRs/shinyWidgets")

Demo :

shinyWidgets::shinyWidgetsGallery()

A live version is available here : http://shinyapps.dreamrs.fr/shinyWidgets

Widgets available :

Bootstrap switch

Turn checkboxes into toggle switches :
switchInput

switchInput(inputId = "id", value = TRUE)

Material switch

Turn checkboxes into toggle switches (again) :
materialSwitch

materialSwitch(inputId = "id", label = "Primary switch", status = "danger")

Pretty Checkbox

Checkbox and radio buttons with the beautiful CSS library pretty-checkbox : prettycheckbox

prettyCheckbox(
  inputId = "pretty_1", label = "Check me!", icon = icon("check")
),
prettyCheckbox(
  inputId = "pretty_2", label = "Check me!", icon = icon("thumbs-up"), 
  status = "default", shape = "curve", animation = "pulse"
),
prettyCheckbox(
  inputId = "pretty_3", label = "Check me!", icon = icon("users"), 
  animation = "pulse", plain = TRUE, outline = TRUE
),
prettyCheckbox(
  inputId = "pretty_4", label = "Check me!",
  status = "success", outline = TRUE
),
prettyCheckbox(
  inputId = "pretty_5", label = "Check me!",
  shape = "round", outline = TRUE, status = "info"
),
 
...
 

Sweet Alert

Displays a message to the user :

sendSweetAlert

See examples in ?sendSweetAlert.

Request confirmation from the user :

confirmSweetAlert

See examples in ?confirmSweetAlert.

Slider Text

Slider with strings, to pass whatever you want :
sliderText

sliderTextInput(
  inputId = "mySliderText", 
  label = "Your choice:", 
  grid = TRUE, 
  force_edges = TRUE,
  choices = c("Strongly disagree",
              "Disagree", "Neither agree nor disagree", 
              "Agree", "Strongly agree")
)

Knob Input

A jQuery based knob, similar to sliderInput or sliderTextInput:
knobInput

knobInput(
  inputId = "myKnob",
  label = "jQuery knob example:",
  value = 0,
  min = -100,
  displayPrevious = TRUE, 
  lineCap = "round",
  fgColor = "#428BCA",
  inputColor = "#428BCA"
)

Select picker

Dropdown menu with a lot of options :
pickerInput

pickerInput(
  inputId = "myPicker", 
  label = "Select/deselect all + format selected", 
  choices = LETTERS, 
  options = list(
    `actions-box` = TRUE, 
    size = 10,
    `selected-text-format` = "count > 3"
  ), 
  multiple = TRUE
)

Checkbox and radio buttons

Turn buttons into checkbox or radio :
checkboxGroupButtons

checkboxGroupButtons(
  inputId = "somevalue", label = "Make a choice :", 
  choices = c("Choice A", "Choice B", " Choice C", "Choice D"), 
  justified = TRUE, status = "primary",
  checkIcon = list(yes = icon("ok", lib = "glyphicon"), no = icon("remove", lib = "glyphicon"))
)

Search bar

A text input only triggered by hitting 'Enter' or clicking search button :
search_input

searchInput(
  inputId = "id", 
  label = "Enter your search :", 
  placeholder = "This is a placeholder", 
  btnSearch = icon("search"), 
  btnReset = icon("remove"), 
  width = "100%"
)

Dropdown button

Hide input in a button :
dropdown_off dropdown_on

dropdownButton(
  tags$h3("List of Input"),
  selectInput(inputId = 'xcol', label = 'X Variable', choices = names(iris)),
  selectInput(inputId = 'ycol', label = 'Y Variable', choices = names(iris), selected = names(iris)[[2]]),
  sliderInput(inputId = 'clusters', label = 'Cluster count', value = 3, min = 1, max = 9),
  circle = TRUE, status = "danger", icon = icon("gear"), width = "300px",
  tooltip = tooltipOptions(title = "Click to see inputs !")
)

And others !

News

shinyWidgets 0.4.8

  • Remove a unit test that was not compatible with an upcoming version of Shiny.

shinyWidgets 0.4.7

  • add useArgonDash to inport functions from argonDash.
  • add useBs4Dash to import functions from bs4Dash.
  • Fix updating searchInput label & placeholder in modules.
  • Fix issue with ghost sidebar in useShinydashboard.
  • Fix issue updating prettyRadio & prettyCheckbox with icons.

shinyWidgets 0.4.5

  • Fix a bug with awesome* widgets due to FontAwesome upgrade in Shiny @AshesITR.
  • New methods for mutating vertical tabs (appendVerticalTab, removeVerticalTab, reorderVerticalTabs) by @ifellows
  • New widget numericRangeInput by @wkdavis.

shinyWidgets 0.4.4

  • New function updateMultiInput for updating multiInput, thanks to @ifellows.
  • New function updateVerticalTabsetPanel for updating verticalTabsetPanel.
  • Update options for knobInput and airDatepickerInput.
  • Custom unit & range in progress bars (arguments unit_mark & range_value in progressBar).
  • Argument update_on to choose when trigger update server-side in spectrumInput.
  • Vertical layout in selectizeGroup.
  • New function pickerOptions to help using pickerInput options argument.
  • Bug fix with size argument in actionGroupButtons.
  • dropdown button act like an actionButton (same behavior as dropdownButton)
  • Update Bootstrap-Select JavaScript library from 1.12.4 to 1.13.3 (used in pickerInput).

shinyWidgets 0.4.3

  • New functions to customize sliderInput : chooseSliderSkin and setSliderColor by @DivadNojnarg.
  • New function downloadBttn, a downloadButton with custom appearance.
  • New widget airDatepickerInput, to select single, multiple and range of dates. You can also select time. And two shortcuts to select months or years.
  • New function to add spinners when outputs are recalculating.
  • New function useShinydashboard to use functions from 'shinydashboard' into a classic 'shiny' app, specifically valueBox, infoBox and box.
  • New functions setBackgroundColor and setBackgroundImage to change background color or use an image, by @DivadNojnarg.

shinyWidgets 0.4.2

  • New function updateSearchInput to update searchInput server-side #52.
  • New argument inline to prettySwitch, prettyToggle and prettyCheckbox to position checkboxes side by side.
  • New argument html to confirmSweetAlert and sendSweetAlert to pass HTML tags in alert window #48.
  • New Shiny modules to create dependent select menu : selectizeGroup and pickerGroup.
  • New widget : noUiSlider, a minimal slider range for numeric values.

shinyWidgets 0.4.1

  • New functions with Sweet Alert : confirmSweetAlert (confirmation dialog box), inputSweetAlert (text input dialog box), progressSweetAlert (progress bar in popup).
  • Update Sweet Alert library to 2.O
  • sendSweetAlert works without using useSweetAlert in UI.
  • Update multi.js to 0.2.4
  • Update bootstrap switch to 3.3.4
  • Change minimal version of R to 3.3.1
  • Function to toggle dropdown server-side : toggleDropdownButton.

Bug fixes :

  • Fix logic on when btn-size class is added to button by @coolbutuseless.
  • Bug in dependencies between pretty* and bttn.

shinyWidgets 0.4.0

  • New widget : spectrumInput for choosing colors in palettes or custom one.
  • New widgets : prettyCheckbox, prettySwitch, prettyToggle, prettyCheckboxGroup and prettyRadioButtons for create pretty checkboxes, toggle switch, radio buttons with colors, icons and a lot of options.
  • New widget : knobInput a round slider, thanks to @DivadNojnarg.

Bug fixes:

  • Bug when initializing (in modal window or in renderUI) pickerInput and switchInput.
  • awesomeCheckboxGroup not working when inline = FALSE, thanks to @meganhartwell-stemcell, @dStudio-git, @Nicolabo to report this.
  • Weird behavior of inputs in dropdown reported by @markdumke.

shinyWidgets 0.3.6

  • New widget : sliderTextInput : a slider for character vector.
  • New arguments choiceNames & choiceValues for checkboxGroupButtons & radioGroupButtons to easily pass HTML in the names displayed on the buttons.
  • New argument inline to materialSwitch, thanks to @FrissAnalytics.

shinyWidgets 0.3.5

  • Support for bookmarking state.
  • Support for tooltip from bsplus.
  • Upgrade pickerInput to bootstrap-select 1.12.4.
  • Upgrade switchInput to bootstrap-switch 3.3.4.
  • Remove receiveSweetAlert for simpler use with useSweetAlert.
  • Add inline argument to materialSwitch (#17).
  • Display code for dropdowns in gallery.

shinyWidgets 0.3.4

This release fix a bug in the gallery and add tests.

Bug fixes

  • Fix a bug when in checkboxGroupButtons when individual = TRUE, causing shinyWidgetsGallery on launch.

shinyWidgets 0.3.3

Several updates methods implemented.

New features

  • Add function updateAwesomeCheckbox for updating single awesome checkbox.
  • New function panel to create similar panel than in shinydashboard.
  • New arguments and examples for updateSwitchInput, updateRadioGroupButtons, updateCheckboxGroupButtons, updateAwesomeRadio, updateAwesomeCheckboxGroup

Minor new features and improvements

  • Buttons in searchInput are now actionButton, see #11

shinyWidgets 0.3.2

Better documentation and examples. Alternative function to create a dropdown. New function colorSelector.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("shinyWidgets")

0.4.9 by Victor Perrier, 13 days ago


https://github.com/dreamRs/shinyWidgets


Report a bug at https://github.com/dreamRs/shinyWidgets/issues


Browse source code at https://github.com/cran/shinyWidgets


Authors: Victor Perrier [aut, cre] , Fanny Meyer [aut] , David Granjon [aut] , Ian Fellows [ctb] (Methods for mutating vertical tabs & updateMultiInput) , Wil Davis [ctb] (numericRangeInput function) , SnapAppointments [cph] (bootstrap-select) , Mattia Larentis [ctb, cph] (Bootstrap Switch) , Emanuele Marchi [ctb, cph] (Bootstrap Switch) , Mark Otto [ctb] (Bootstrap library) , Jacob Thornton [ctb] (Bootstrap library) , Bootstrap contributors [ctb] (Bootstrap library) , Twitter , Inc [cph] (Bootstrap library) , Flatlogic [cph] (Awesome Bootstrap Checkbox) , mouse0270 [ctb, cph] (Material Design Switch) , Tristan Edwards [ctb, cph] (SweetAlert) , Fabian Lindfors [ctb, cph] (multi.js) , Anthony Terrien [ctb, cph] (jQuery Knob) , Daniel Eden [ctb, cph] (animate.css) , Ganapati V S [ctb, cph] (bttn.css) , Brian Grinstead [ctb, cph] (Spectrum) , Lokesh Rajendran [ctb, cph] (pretty-checkbox) , Leon Gersen [ctb, cph] (wnumb & noUiSlider) , Timofey Marochkin [ctb, cph] (air-datepicker) , Tobias Ahlin [ctb, cph] (CSS spin)


Documentation:   PDF Manual  


GPL-3 | file LICENSE license


Imports shiny, htmltools, jsonlite, grDevices, scales

Suggests shinydashboard, viridisLite, RColorBrewer, testthat, covr, shinydashboardPlus, bs4Dash, argonR, argonDash, tablerDash


Imported by AdhereR, BayesianNetwork, CaPO4Sim, MtreeRing, UCSCXenaShiny, corporaexplorer, dplyrAssist, dragon, eAnalytics, esquisse, ggplotAssist, gimmeTools, iSTATS, jsmodule, memapp, plethem, powdR, predictoR, processR, regressoR, rpostgisLT, safetyGraphics, shinyML, shinyhttr, trackeRapp, viromeBrowser, wiseR.

Suggested by TestDesign, bs4Dash, compareGroups, getTBinR, shinydashboardPlus, tablerDash, visNetwork.


See at CRAN