Learn R Programming

⚠️There's a newer version (0.9.0) of this package.Take me there.

shinyWidgets

Extend widgets available in shiny

Overview

This package offers custom widgets and other components to enhance your shiny applications.

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

Install from CRAN with:

install.packages("shinyWidgets")

Or install the development version from GitHub with:

# install.packages("remotes")
remotes::install_github("dreamRs/shinyWidgets")

Demo

A gallery application is included in the package. Once installed, use the following command to launch it:

shinyWidgets::shinyWidgetsGallery()

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

Bootstrap switch

Turn checkboxes into toggle switches :

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

Material switch

Turn checkboxes into toggle switches :

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

Pretty Checkbox

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

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

Show an alert message to the user to provide some feedback, via sweetalert2 library:

See examples in ?show_alert.

Request confirmation from the user :

See examples in ?ask_confirmation.

Slider Text

Slider with strings, to pass whatever you want :

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

Select picker

Dropdown menu with a lot of options :

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(
  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 input

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

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 :

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("cog"), width = "300px",
  tooltip = tooltipOptions(title = "Click to see inputs !")
)

See also ?dropMenu()

Copy Link

Version

Install

install.packages('shinyWidgets')

Monthly Downloads

68,420

Version

0.7.2

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Victor Perrier

Last Published

August 7th, 2022

Functions in shinyWidgets (0.7.2)

airDatepicker

Air Date Picker Input
animations

Animation names
animateOptions

Animate options
autonumericInput

Autonumeric Input Widget
actionBttn

Awesome action button
appendVerticalTab

Mutate Vertical Tabset Panel
awesomeCheckbox

Awesome Checkbox Input Control
addSpinner

Display a spinner above an output when this one recalculate
awesomeCheckboxGroup

Awesome Checkbox Group Input Control
actionGroupButtons

Actions Buttons Group Inputs
colorPickr

Color Pickr
downloadBttn

Create a download actionBttn
bootstrap-utils

Bootstrap panel / alert
awesomeRadio

Awesome Radio Buttons Input Control
demoAirDatepicker

Some examples on how to use airDatepickerInput
demoNoUiSlider

Some examples on how to use noUiSliderInput
dropMenuOptions

Drop menu options
dropMenu

Drop Menu
chooseSliderSkin

Theme selector for sliderInput
checkboxGroupButtons

Buttons Group checkbox Input Control
demoNumericRange

An example showing how numericRangeInput works
drop-menu-interaction

Interact with Drop Menu
currencyInput

Format Numeric Inputs
html-dependencies

HTML dependencies
circleButton

Circle Action button
execute_safely

Execute an expression safely in server
noUiSliderInput

Numeric range slider
updateCurrencyInput

Update a Formatted Numeric Input Widget
closeSweetAlert

Close Sweet Alert
prettySwitch

Pretty Switch Input
demoVirtualSelect

Demo for virtualSelectInput()
prettyToggle

Pretty Toggle Input
colorSelectorInput

Color Selector Input
dropdown

Dropdown
selectizeGroup-module

Selectize Group
radioGroupButtons

Buttons Group Radio Input Control
pickerInput

Select Picker Input Control
pickerOptions

Options for pickerInput
numericInputIcon

Create a numeric input control with icon(s)
inputSweetAlert

Launch an input text dialog
materialSwitch

Material Design Switch Input Control
progress-bar

Progress Bars
dropdownButton

Dropdown Button
multiInput

Create a multiselect input control
knobInput

Knob Input
progressSweetAlert

Progress bar in a sweet alert
prepare_choices

Prepare choices for virtualSelectInput()
prettyCheckbox

Pretty Checkbox Input
setBackgroundColor

Custom background color for your shinyapp
numericRangeInput

Numeric Range Input
setSliderColor

Color editor for sliderInput
updatePrettyCheckboxGroup

Change the value of a pretty checkbox on the client
tooltipOptions

Tooltip options
updatePrettyRadioButtons

Change the value pretty radio buttons on the client
updateAwesomeCheckbox

Change the value of an awesome checkbox input on the client
updateAwesomeCheckboxGroup

Change the value of a awesomeCheckboxGroup input on the client
toggleDropdownButton

Toggle a dropdown menu
setBackgroundImage

Custom background image for your shinyapp
setShadow

Custom shadows
searchInput

Search Input
updateSliderTextInput

Change the value of a slider text input on the client
shinyWidgets

shinyWidgets: Custom inputs widgets for Shiny.
stati-card

Minimal statistic cards
prettyCheckboxGroup

Pretty Checkbox Group Input Control
prettyRadioButtons

Pretty radio Buttons Input Control
pickerGroup-module

Picker Group
updateAutonumericInput

Update an Autonumeric Input Object
textInputIcon

Create a text input control with icon(s)
shinyWidgetsGallery

Launch the shinyWidget Gallery
textInputAddon

Text with Add-on Input Control
updateAirDateInput

Change the value of airDatepickerInput() on the client
show_toast

Show a toast notification
sliderTextInput

Slider Text Input Widget
updateSpectrumInput

Change the value of a spectrum input on the client
wNumbFormat

Format numbers in noUiSliderInput
updateNumericInputIcon

Change the value of a numeric input icon on the client
sweetalert-confirmation

Launch a confirmation dialog
updateVirtualSelect

Update virtual select from server
updatePrettyCheckbox

Change the value of a pretty checkbox on the client
updatePickerInput

Change the value of a select picker input on the client
updateVerticalTabsetPanel

Update selected vertical tab
spectrumInput

Palette Color Picker with Spectrum Library
updateMultiInput

Change the value of a multi input on the client
updateRadioGroupButtons

Change the value of a radio group buttons input on the client
updateNoUiSliderInput

Change the value of a no ui slider input on the client
updateNumericRangeInput

Change the value of a numeric range input
updateKnobInput

Change the value of a knob input on the client
sweetalert

Display a Sweet Alert to the user
updateMaterialSwitch

Change the value of a materialSwitch input on the client
useTablerDash

Use 'tablerDash' in 'shiny'
useBs4Dash

Use 'bs4Dash' in 'shiny'
useSweetAlert

Load Sweet Alert dependencies
useArgonDash

Use 'argonDash' in 'shiny'
switchInput

Bootstrap Switch Input Control
updatePrettySwitch

Change the value of a pretty switch on the client
updateCheckboxGroupButtons

Change the value of a checkboxes group buttons input on the client
updateAwesomeRadio

Change the value of a radio input on the client
updatePrettyToggle

Change the value of a pretty toggle on the client
updateSwitchInput

Change the value of a switch input on the client
updateTextInputIcon

Change the value of a text input icon on the client
vertical-tab

Vertical tab panel
virtualSelectInput

Virtual Select Input
updateSearchInput

Change the value of a search input on the client
useShinydashboardPlus

Use 'shinydashboardPlus' in 'shiny'
useShinydashboard

Use 'shinydashboard' in 'shiny'