Giter VIP home page Giter VIP logo

shinywidgets's Introduction

shinyWidgets

Extend widgets available in shiny

version cranlogs cran checks Coverage Status AppVeyor build status R-CMD-check

Overview

This package provide 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

Widgets

Single checkbox

  • Bootstrap switch

Turn checkboxes into toggle switches :

switchInput

switchInput(inputId = "id", value = TRUE)
  • Material switch

Turn checkboxes into toggle switches :

materialSwitch

materialSwitch(inputId = "id", label = "Primary switch", status = "danger")
  • Pretty checkbox
prettyCheckbox(
  inputId = "id", label = "Check me!", icon = icon("check")
)
  • Pretty switch
prettySwitch(
  inputId = "id",
  label = "Switch:",
  fill = TRUE, 
  status = "primary"
)
  • Pretty toggle
prettyToggle(
  inputId = "id",
  label_on = "Checked!",
  label_off = "Unchecked..."
)

Checkboxes and radio buttons

  • Bootstrap buttons

checkboxGroupButtons

checkboxGroupButtons( # or radioGroupButtons
  inputId = "id",
  label = "Choice: ",
  choices = c("A", "B", "C")
)
  • Pretty checkbox group and radio buttons
prettyCheckboxGroup( # or prettyRadioButtons
  inputId = "id",
  label = "Choice",
  choices = c("A", "B", "c"),
  outline = TRUE,
  plain = TRUE,
  status = "primary",
  icon = icon("check")
)

Select menu

  • Bootstrap select picker

Select menu with lot of configurations options available:

pickerInput

pickerInput(
  inputId = "id", 
  label = "Select:", 
  choices = month.name, 
  options = pickerOptions(
    actionsBox = TRUE, 
    size = 10,
    selectedTextFormat = "count > 3"
  ), 
  multiple = TRUE
)
  • Virtual select

Select menu that can support long list of choices:

virtualSelectInput

virtualSelectInput(
  inputId = "id",
  label = "Select:",
  choices = list(
    "Spring" = c("March", "April", "May"),
    "Summer" = c("June", "July", "August"),
    "Autumn" = c("September", "October", "November"),
    "Winter" = c("December", "January", "February")
  ),
  showValueAsTags = TRUE,
  search = TRUE,
  multiple = TRUE
)

Date picker

  • Air Datepicker

Date (or month or year) picker with lot of options and a timepicker integrated :

airDatepickerInput

airDatepickerInput(
  inputId = "id",
  label = "Select:",
  placeholder = "Placeholder",
  multiple = 5, 
  clearButton = TRUE
)

Sliders

  • Slider with Text

Slider with strings, to pass whatever you want:

sliderText

sliderTextInput(
  inputId = "id", 
  label = "Choice:", 
  grid = TRUE, 
  force_edges = TRUE,
  choices = c(
    "Strongly disagree",
    "Disagree",
    "Neither agree nor disagree", 
    "Agree", 
    "Strongly agree"
  )
)
  • noUiSlider

A range slider that can be colored, have more than two handles and positioned vertically (among other things):

noUiSliderInput

noUiSliderInput(
  inputId = "id",
  label = "Select:",
  min = 0, 
  max = 600,
  value = c(100, 220, 400),
  tooltips = TRUE,
  step = 1
)

Tree

  • Tree check

Select value(s) in a hierarchical structure:

treeInput

treeInput(
  inputId = "ID2",
  label = "Select cities:",
  choices = create_tree(cities),
  returnValue = "text",
  closeDepth = 1
)

Text

  • Search

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%"
)

Other functionnalities

Sweet Alert

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

sendSweetAlert

See examples in ?show_alert.

Request confirmation from the user :

confirmSweetAlert

See examples in ?ask_confirmation.

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 !")
)

See also ?dropMenu()

Development

This package use {packer} to manage JavaScript assets, see packer's documentation for more.

Install nodes modules with:

packer::npm_install()

Modify inputs bindings in srcjs/inputs/, then run:

packer::bundle()

Re-install R package and try functions.

shinywidgets's People

Contributors

andyquinterom avatar artemklevtsov avatar ashesitr avatar coolbutuseless avatar cpsievert avatar dependabot[bot] avatar divadnojnarg avatar ericnewkirk avatar evgeniyftw avatar hrngultekin avatar ifellows avatar ismirsehregal avatar jassler avatar jcheng5 avatar jonmcalder avatar mayagans avatar michallauer avatar mkranj avatar muschellij2 avatar nelson-gon avatar pvictor avatar qfazille avatar shannonpileggi avatar srmatth avatar statnmap avatar stla avatar sverrefl avatar swsoyee avatar tlnd-rnedellec avatar wch avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

shinywidgets's Issues

(update)AwesomeCheckboxGroup not working with shiny modules

Hi
The following does not work with a simple shiny module.
The output$res just stays NULL (after clicking on the input$somevalue)

library(shiny)
library(shinyWidgets)

moduleUI <- function(id){
  ns <- NS(id)
  fluidPage(
    awesomeCheckboxGroup(
      # checkboxGroupInput(
      inputId = ns("somevalue"),
      choices = c("A", "B", "C"),
      label = "My label"
    ),
verbatimTextOutput(outputId = ns("res")),
actionButton(inputId = ns("updatechoices"), label = "Random choices")
  )
}
module <- function(input, output, session) {
  output$res <- renderPrint({
    input$somevalue
  })
  observeEvent(input$updatechoices, {
    updateAwesomeCheckboxGroup(
      # updateCheckboxGroupInput(
      session = session, inputId = "somevalue",
      choices = sample(letters, sample(2:6))
    )
  })
}
ui <- fluidPage(
  moduleUI("module")
)
server <- function(input, output, session) {
  callModule(module, "module")
}
shinyApp(ui = ui, server = server)

However using shiny::CheckboxGroupInput does not produce this error, (can test by uncommenting and commenting above code)

At first I thought it was only when using the updateAwesomeCheckboxGroup that there are problems but sometimes without using it causes problems.

Below is

> sessionInfo()
R version 3.4.2 (2017-09-28)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

Matrix products: default

locale:
[1] LC_COLLATE=English_South Africa.1252  LC_CTYPE=English_South Africa.1252   
[3] LC_MONETARY=English_South Africa.1252 LC_NUMERIC=C                         
[5] LC_TIME=English_South Africa.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] shinyWidgets_0.3.6 shiny_1.0.5       

loaded via a namespace (and not attached):
 [1] compiler_3.4.2  R6_2.2.1        htmltools_0.3.6 tools_3.4.2     Rcpp_0.12.12    jsonlite_1.5   
 [7] digest_0.6.12   xtable_1.8-2    httpuv_1.3.5    mime_0.5       

ShinyWidgetsGallery() demo fails to run

In the most recent CRAN version 0.3.3.

Warning: Error in FUN: could not find function "btn_wrapper"
Stack trace (innermost first):
    84: FUN
    83: lapply
    82: generateCBGB
    81: tag
    80: tags$div
    79: tag
    78: tags$div
    77: tagList
    76: <Anonymous>
    75: do.call
    74: tagList
    73: widget_wrapper [/home/leon/R/x86_64-redhat-linux-gnu-library/3.3/shinyWidgets/examples/shinyWidgets/global.R#64]
    72: tag
    71: tags$div
    70: div
    69: tag
    68: tags$div
    67: div
    66: tag
    65: tags$div
    64: div
    63: box
    62: box_wrapper [/home/leon/R/x86_64-redhat-linux-gnu-library/3.3/shinyWidgets/examples/shinyWidgets/global.R#81]
    61: tag
    60: tags$div
    59: div
    58: column
    57: tag
    56: tags$div
    55: div
    54: fluidRow
    53: tag
    52: tags$div
    51: div
    50: tabItem
    49: lapply
    48: tabItems
    47: tag
    46: tags$section
    45: tag
    44: tags$div
    43: div
    42: dashboardBody
     2: shiny::runApp
     1: shinyWidgetsGallery
Error : could not find function "btn_wrapper"

lack of documentation on options

I was having immense struggles seeing what the options to pickerInput were, event after looking at the source code. Documentation would be lovely - because the overlay title being a concatenation of the selected values is obnoxious in my use case.

Thanks.

"ERROR: package or namespace load failed for ‘shinyWidgets’" while loading through Server

Hi Team

I'm using ShinyWidgets library in my RShiny dashboard. While it works when I locally 'runApp' in browser, I'm getting the following error when my start my dashboard through a server link

ERROR: package or namespace load failed for ‘shinyWidgets’

I've explicitly installed and loaded following dependency libraries as well, but the problem persists:
shinydashboard, formatR, viridisLite, RColorBrewer, testthat, and covr

Following is the sessionInfo of local run
`

sessionInfo()
R version 3.2.3 (2015-12-10)
Platform: x86_64-redhat-linux-gnu (64-bit)
Running under: Red Hat Enterprise Linux Server release 6.9 (Santiago)

locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8
[6] LC_MESSAGES=en_US.UTF-8 LC_PAPER=en_US.UTF-8 LC_NAME=en_US.UTF-8 LC_ADDRESS=en_US.UTF-8 LC_TELEPHONE=en_US.UTF-8
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=en_US.UTF-8

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] shinyWidgets_0.4.0 shinyjs_0.9.1 RRWE_0.1-1 RODBC_1.3-12 DT_0.1 shinyBS_0.61 zoo_1.7-13
[8] timevis_0.4 stringr_1.0.0 rvest_0.3.2 xml2_1.0.0 sunburstR_0.6.0 scales_0.4.1 ReporteRs_0.8.6
[15] ReporteRsjars_0.0.2 RColorBrewer_1.1-2 rpivotTable_0.1.5.20 devtools_1.10.0 rmarkdown_1.3 plotly_4.7.1 ggplot2_2.2.1
[22] data.table_1.10.4 jsonlite_0.9.19 htmltools_0.3.5 knitr_1.15.1 shinydashboard_0.5.1 shiny_1.0.0

loaded via a namespace (and not attached):
[1] purrr_0.2.2 rJava_0.9-8 lattice_0.20-33 colorspace_1.2-6 miniUI_0.1.1 viridisLite_0.1.3 yaml_2.1.13 R.oo_1.20.0
[9] DBI_0.3.1 R.utils_2.3.0 gdtools_0.0.7 plyr_1.8.4 munsell_0.4.3 gtable_0.2.0 R.methodsS3_1.7.1 htmlwidgets_0.9
[17] evaluate_0.10 memoise_1.0.0 crosstalk_1.0.0 httpuv_1.3.3 parallel_3.2.3 Rcpp_0.12.5 xtable_1.8-2 backports_1.0.4
[25] mime_0.4 png_0.1-7 digest_0.6.9 stringi_1.1.1 dplyr_0.4.3 grid_3.2.3 rprojroot_1.2 tools_3.2.3
[33] magrittr_1.5 lazyeval_0.2.0 tibble_1.2 tidyr_0.4.1 rvg_0.1.0 assertthat_0.1 httr_1.1.0 R6_2.1.2
`

Please let me know if you need any additional information regarding this.

Thanks
Nishant Gupta

pickerInput inside dropdownButton

Hi!

First of all, thanks for your great package! I pimp my apps since I've get it!

pickerInput don't work as expected when inside a dropdownButton : dropdown panel is closed when the picker menu is clicked. Here's a reproducible example :
`if (interactive()) {
library("shiny")
library("shinyWidgets")

ui <- fluidPage(
		fluidRow(
				column(1, 
						dropdownButton(icon = icon('gear'), width = "400px", 
								pickerInput(
										inputId = "id", label = "Fruits :",
										choices = c("Banana", "Blueberry", "Cherry"),
										selected = "Banana", width = "350px"
								)
						)
				),
				column(11, br(), verbatimTextOutput(outputId = "res"))
		)
)

server <- function(input, output, session) {
	output$res <- renderPrint({
				input$id
			})
}

shinyApp(ui = ui, server = server)

}
`
And I've a little request : can you put the code on the "other stuffs" page of shinyWidgetsGallery(), specially for the second dropdown button? It's animation is really nice! I'm less interested by the panel slide animation...

Thanks again for your work!

Special characters bug in pickerInput

Special characters like "&" , ">", and "<" are displayed as "$amp;", "<", and ">". I believe this is related to UTF encoding. For selectInput / selectizeInput in Shiny, special characters are treated correctly and I never had problems with th I am not sure what makes pickerInput not behave the same

library(shiny)
library(shinyWidgets)

server <- function(input, output) {
  output$pickerSelectionOutput <- renderText({
    paste("pickerInput value: ", input$pickerSelection)
  })
  output$selectSelectionOutput <- renderText({
    paste("selectInput value: ", input$selectSelection)
  })
}

ui <- fluidPage(
  sidebarLayout(
    sidebarPanel(
      pickerInput("pickerSelection", "Has Special Characters",
                  choices = 
                    list("Special Character: &" = c("one & two" = "three & four"),
                         "Special Character: <, <=" = c("one <, <= two" = "three <, <= four"),
                         "Special Character: >, >=" = c("one >, >= two" = "three >, >= four")
                         )
      ),
      selectInput("selectSelection", "Has Special Characters",
                  choices = 
                    list("Special Character: &" = c("one & two" = "three & four"),
                         "Special Character: <, <=" = c("one <, <= two" = "three <, <= four"),
                         "Special Character: >, >=" = c("one >, >= two" = "three >, >= four")
                    ))
    ),
    mainPanel(
      wellPanel(
        textOutput("pickerSelectionOutput"),
        textOutput("selectSelectionOutput")
      ))
  )
)

shinyApp(ui = ui, server = server)

p.s. the library is very useful, especially the dropdownButton()!

updateSearchInput ?

Hi,

I am wondering if you can add updateSearchInput just like other input UI. I understand there's a button involved so it may be a bit tricky. I personally attempted to do that using session$sendInputMessage but it won't simulate button click to trigger input value change. Any idea?

Steve

bug click in pickerInput when is inside dropdownButton

Hi,

I found this bug. When pickerInput is inside a dropdownButton, clicking on the selection bar does not open the menu.

Here a minimal working example

library("shiny")
library("shinyWidgets")

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

ui <- fluidPage(
  tags$h1("Picker behaviour", style="color: steelblue;"),
  fluidRow(
    column(
      width = 6,
      pickerInput(inputId = "id1", label = "Click works", choices = c("a", "b", "c", "d"))
    ),
    column(
      width = 6,
      dropdownButton(
        pickerInput(inputId = "id2", label = "Click doesn't work", choices = c("a", "b", "c", "d")),
        circle = TRUE,
        status = "default",
        icon = icon("gear"),
        label = "Click on me", tooltip = FALSE, width = NULL)
    )
  )
)


shinyApp(ui = ui, server = server)

shinyjs reset is not working with shinyWidgets switchInput

Hi,

shinyjs reset is working for materialSwitch, but it is not working for switchInput.

here an example

library(shiny)
library(shinyjs)
library(shinyWidgets)

#### Server ####
server <- function(input, output){
  
  observeEvent(input$reset_button, {
    shinyjs::reset("checkbox_1")
    shinyjs::reset("switch_1")
    shinyjs::reset("switch_2")
  })
  
  output$checkbox_1_output <- renderPrint({
    input$checkbox_1
  })
  
  output$switch_1_output <- renderPrint({
    input$switch_1
  })
  
  output$switch_2_output <- renderPrint({
    input$switch_2
  })
  
  
}

#### UI ####
ui <- fluidPage(
  useShinyjs(),
  fluidRow(
    column(
      width = 6,
      actionButton(inputId = "reset_button",
                   label = "Reset"),
      hr(),
      verbatimTextOutput("checkbox_1_output"),
      verbatimTextOutput("switch_1_output"),
      verbatimTextOutput("switch_2_output")
    ),
    column(
      width = 6,
      checkboxInput(inputId = "checkbox_1",
                    label = "CHECK",
                    value = F),
      br(),
      switchInput(inputId = "switch_1",
                  Label = "SWITCH 1",
                  value = F),
      br(),
      materialSwitch(inputId = "switch_2",
                     label = "SWITCH 2",
                     value = F,
                     right = T)
    )
  )
  
  
)

#### Run ####
shinyApp(ui = ui, server = server)

searchInput buttons not adhere to text box in shinydashboard sidebar area

Great work first of all!

I noticed my older app built in 0.3.2 behaves a little differently after I upgraded shinyWidgets to 0.3.4+. searchInput in shinydashboard's sidebar now gets separated into 3 components: Textbox, search button and remove button. This is likely due to changes from tags to htmltools::tags

I am no shiny expert but this is likely the only changes made that affects the searchInput functionality.

How to open the modaldialog under a dropdownbutton from code

Hi pvictor,

I found out that the dialog window under a dropdownButton doesn't seem to have an easyclose = T/F option,

related to that, is there a way to trigger the opening of the window from the server side? I have some code functionality that closes a modalDialog that is opened by a button inside the dropdownbutton modal window. Closing this second modalDialog sadly also closes the dropdownButton panel, which I would like to be able to re-open, or keep open even when it is closed by other modals.

Would you know a solution for this in combination with your widget?

awesomeCheckboxGroup Bug with latest version

Hello,
I love the package, it makes my apps look much more appealing, thank you for sharing it!
I updated to the latest version of shinyWidgets today (0.3.6) and the awesomeCheckboxGroup input is no longer returning anything if inline=FALSE. However if inline=TRUE it correctly returns the selections. I noticed this on my app as well as on shinyWidgetsGallery(). I believe this is probably a bug in the coding, though I also wondered if it was a conflict with one of my other packages?

image

Thank you!

input values not available until menu is opened

Hello,
I have been trying the dropdownbutton in my app to see if it would be a nice improvement.
In my app I construct a plotly plot from a custom fuction that takes a lot of input$variables to make the plot, i.e. marker size, axis titles etc are all coming from options the user has to customize the app.
In the test version, all these inputs are in the main panel, so today I tried to put them inside a dropdownButton. However, it seems that non of the input elements register (i.e. input values not available) until the menu is opened. This means for me that on start up of the app, no plot can be made until the dropdownButton menu is opened.
Is this normal?

pickerInput won't show inside renderMenu

library(shiny)
library(shinydashboard)
library(shinyWidgets)

ui <- dashboardPage(
dashboardHeader(),
dashboardSidebar(

sidebarMenuOutput("menu"),

sliderInput("x", "Outside of menu", 1, 100, 50)),

dashboardBody()
)

server <- function(input, output) {
output$menu <- renderMenu({
sidebarMenu(id = "sidebarmenu",
menuItem("A", tabName = "a", icon = icon("group", lib="font-awesome")),
menuItem("B", tabName = "b", icon = icon("check-circle", lib = "font-awesome")),
conditionalPanel("input.sidebarmenu === 'b'",
sliderInput("c", "Under sidebarMenu", 1, 100, 50),

                             pickerInput(
                               inputId = "p1",
                               label = "Select all option",
                               choices = rownames(mtcars),
                               multiple = TRUE,
                               options = list(`actions-box` = TRUE,`selected-text-format` = "count > 3")
                             )
            )
)

})
}

shinyApp(ui, server)

Thanks for the package, I'm trying to render pickerInput, but it doesn't seem to work under tab b. Any thoughts to solve this?

Cheers

feature request: add inline option for buttons

hi!

great package! Small question, can you add an option to have buttons e.g. a materialSwitch behave like inline elements? Say with an option materialSwitch( ..., inline = TRUE). Sometimes you want to place buttons next to each other instead of below each other.

kind regards, Herman

Specify inputID in dropdownButton

Would this not be a "quick" change?

dropdownButton <- function (... ,inputId=NULL, circle = TRUE, status = "default", size = "default",
icon = NULL, label = NULL, tooltip = FALSE, right = FALSE,
up = FALSE, width = NULL)
{
status <- match.arg(arg = status, choices = c("default",
"primary", "success", "info", "warning", "danger"))
size <- match.arg(arg = size, choices = c("default", "lg",
"sm", "xs"))
buttonID <- inputId
html_ul <- list(class = paste("dropdown-menu", ifelse(right,
"dropdown-menu-right", "")), class = "dropdown-shinyWidgets",
id = paste("dropdown-menu", buttonID, sep = "-"), style = if (!is.null(width)) paste0("width: ",
htmltools::validateCssUnit(width), ";"), aria-labelledby = buttonID,
lapply(X = list(...), FUN = htmltools::tags$li, style = "margin-left: 10px; margin-right: 10px;"))
if (circle) {
html_button <- circleButton(inputId = buttonID, icon = icon,
status = status, size = size, class = "dropdown-toggle",
data-toggle = "dropdown")
}
else {
html_button <- list(class = paste0("btn btn-", status,
" dropdown-toggle "), class = if (size == "default") paste0("btn-",
size), type = "button", id = buttonID, data-toggle = "dropdown",
aria-haspopup = "true", aria-expanded = "true",
list(icon, label), tags$span(class = "caret"))
html_button <- do.call(htmltools::tags$button, html_button)
}
if (identical(tooltip, TRUE))
tooltip <- tooltipOptions(title = label)
if (!is.null(tooltip) && !identical(tooltip, FALSE)) {
tooltip <- lapply(tooltip, function(x) {
if (identical(x, TRUE))
"true"
else if (identical(x, FALSE))
"false"
else x
})
tooltipJs <- htmltools::tags$script(sprintf("$('#%s').tooltip({ placement: '%s', title: '%s', html: %s });",
buttonID, tooltip$placement, tooltip$title, tooltip$html))
}
else {
tooltipJs <- ""
}
dropdownTag <- htmltools::tags$div(class = ifelse(up, "dropup",
"dropdown"), html_button, do.call(htmltools::tags$ul,
html_ul), tooltipJs)
attachShinyWidgetsDep(dropdownTag, "dropdown")
}

Supported icons in actionBttn?

I really like the actionBttn you've implemented in this great package, and I'd like to add an icon to the left of the label from font awesome like I can with the typical shiny actionButton. But when I supply the icon parameter with a value, it just shows the icon text and not the actual icon. I'm trying to put a rocket icon and tried the two methods below with no success. Any suggestions on how to get an icon to properly appear? I'm using version 0.3.6 from CRAN.

# first try: no fa- prefix
actionBttn(inputId = "execProcess",
label = "Launch",
icon = "rocket",
style = "gradient",
color = "primary",
size = "md",
no_outline = FALSE)

# second try: fa-prefix
actionBttn(inputId = "execProcess",
label = "Launch",
icon = "fa-rocket",
style = "gradient",
color = "primary",
size = "md",
no_outline = FALSE)

How to force dropdown click on page load

Hi, love the package, use it a lot, thank you very much for creating it! I have a small issue where I need to force the sw-dropdown to click open on client visit as I have dependencies under renderUI. How can I achieve this? As can be seen from my example the uiOutput("S1") doesnt render until the dropdown is clicked, but uiOutput("S2") does not.

library("shiny")
library("shinyWidgets")
ui <- fluidPage(
  dropdown(style = "unite", icon = icon("gear"),status = "danger", width = "300px",
    uiOutput("S1")
  ),
  uiOutput("S2")
)

server <- function(input, output, session) {
  output$S1 <- renderUI({
    radioGroupButtons("Species", label = "Species", choices = unique(iris$Species), status = "success")
  })
  output$S2 <- renderUI({
    radioGroupButtons("Species2", label = "Species2", choices = unique(iris$Species), status = "success")
  })
}
shinyApp(ui = ui, server = server)

Disable sorting in pickerInput

Hello!

pickerInput(inputId = "values", label = "Select values", choices = c(1, 2, 3, 4, 5))

If I select values in next order: 5,1,2,4. And get values from input they will be sorted
Is there any way to disable sorting then getting selected values of pickerInput?

Select a whole group in pickerInput

First of all, thank you for your wonderful package !
I am currently using the pickerInput, with grouped choices (in a list).
I am looking for a way to select/unselect a whole groupe in one click (ex. by clicking on the name of the group or something else...)

In the following example I would like to quickly select all the "listA" choices.

library("shiny")
library("shinyWidgets")

ui <- fluidPage(
  br(),
  pickerInput(
    inputId = "p1",
    label = "Default",
    multiple = TRUE,
    choices = list("listA"=rownames(mtcars)[1:16], "listB"=rownames(mtcars)[17:32]),
    selected = rownames(mtcars)
  )
)
server <- function(input, output, session) {}
shinyApp(ui = ui, server = server)

Thank you
Elise

Update content

Pvictor. Sorry it is me again with another question.

I tried to use updatecheckboxinput code to try and change a checkbox from true to false of a checkboxinput inside a dropdownbutton panel.
If this code to update is triggered by a button inside the panel, I.e. the panel is currently open, it works fine. However, I also need to load default on and offs for some checkboxes when the user starts the shiny app, while menu is closed. In this case the updatecheckbox fails to do anything. I even tried suspendwhenhidden = false inside the outoutoption call on both the dropdownbutton ID, the uiOutput id that makes the checkboxes, also tried on checkboxes made directly inside the panel (I.e. not with renderUI) and on the checkboxinput ID tags directly but in non of the scenarios does update checkboxinput (id , .... , value = True ) actually work.

Any clues what I am missing or doing wrong?

Error: could not find function "checkboxGroupButtons"

Hi All

I'm working on RShiny dashboard development that will eventually be hosted on shiny server. I'm facing an issue with shinyWidgets rendering on LOCAL is fine, but rendering through SERVER link is giving me the following error:

Error: could not find function "checkboxGroupButtons"

On LOCAL run:
`> sessionInfo()
R version 3.2.3 (2015-12-10)
Platform: x86_64-redhat-linux-gnu (64-bit)
Running under: Red Hat Enterprise Linux Server release 6.9 (Santiago)

locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 LC_PAPER=en_US.UTF-8 LC_NAME=en_US.UTF-8
[9] LC_ADDRESS=en_US.UTF-8 LC_TELEPHONE=en_US.UTF-8 LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=en_US.UTF-8

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] shinyjs_0.9.1 DT_0.1 shinyBS_0.61 shinyWidgets_0.4.0 covr_1.2.0 testthat_0.11.0
[7] viridisLite_0.1.3 formatR_1.3 zoo_1.7-13 timevis_0.4 stringi_1.1.1 stringr_1.0.0
[13] rvest_0.3.2 xml2_1.0.0 sunburstR_0.6.0 scales_0.4.1 ReporteRs_0.8.6 ReporteRsjars_0.0.2
[19] RColorBrewer_1.1-2 rpivotTable_0.1.5.20 devtools_1.10.0 rmarkdown_1.3 plotly_4.7.1 ggplot2_2.2.1
[25] data.table_1.10.4 jsonlite_0.9.19 htmltools_0.3.5 knitr_1.15.1 shinydashboard_0.5.1 shiny_1.0.0

loaded via a namespace (and not attached):
[1] Rcpp_0.12.5 lattice_0.20-33 tidyr_0.4.1 png_0.1-7 assertthat_0.1 rprojroot_1.2 digest_0.6.9 mime_0.4
[9] R6_2.1.2 plyr_1.8.4 backports_1.0.4 evaluate_0.10 httr_1.1.0 gdtools_0.0.7 lazyeval_0.2.0 miniUI_0.1.1
[17] R.utils_2.3.0 R.oo_1.20.0 htmlwidgets_0.9 munsell_0.4.3 httpuv_1.3.3 rvg_0.1.0 tibble_1.2 crayon_1.3.1
[25] dplyr_0.4.3 R.methodsS3_1.7.1 grid_3.2.3 xtable_1.8-2 gtable_0.2.0 DBI_0.3.1 magrittr_1.5 rex_1.1.1
[33] tools_3.2.3 purrr_0.2.2 crosstalk_1.0.0 parallel_3.2.3 yaml_2.1.13 colorspace_1.2-6 memoise_1.0.0 rJava_0.9-8
`

image

On SERVER:
`R version 3.2.3 (2015-12-10)
Platform: x86_64-redhat-linux-gnu (64-bit)
Running under: Red Hat Enterprise Linux Server release 6.9 (Santiago)

locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 LC_PAPER=en_US.UTF-8 LC_NAME=en_US.UTF-8
[9] LC_ADDRESS=en_US.UTF-8 LC_TELEPHONE=en_US.UTF-8 LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=en_US.UTF-8

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] shinyjs_0.9.1 DT_0.1 shinyBS_0.61 shinyWidgets_0.4.0 covr_1.2.0 testthat_0.11.0
[7] viridisLite_0.1.3 formatR_1.3 zoo_1.7-13 timevis_0.4 stringi_1.1.1 stringr_1.0.0
[13] rvest_0.3.2 xml2_1.0.0 sunburstR_0.6.0 scales_0.4.1 ReporteRs_0.8.6 ReporteRsjars_0.0.2
[19] RColorBrewer_1.1-2 rpivotTable_0.1.5.20 devtools_1.10.0 rmarkdown_1.3 plotly_4.7.1 ggplot2_2.2.1
[25] data.table_1.10.4 jsonlite_0.9.19 htmltools_0.3.5 knitr_1.15.1 shinydashboard_0.5.1 shiny_1.0.0

loaded via a namespace (and not attached):
[1] Rcpp_0.12.5 lattice_0.20-33 tidyr_0.4.1 png_0.1-7 assertthat_0.1 rprojroot_1.2 digest_0.6.9 mime_0.4
[9] R6_2.1.2 plyr_1.8.4 backports_1.0.4 evaluate_0.10 httr_1.1.0 gdtools_0.0.7 lazyeval_0.2.0 miniUI_0.1.1
[17] R.utils_2.3.0 R.oo_1.20.0 htmlwidgets_0.9 munsell_0.4.3 httpuv_1.3.3 rvg_0.1.0 tibble_1.2 crayon_1.3.1
[25] dplyr_0.4.3 R.methodsS3_1.7.1 grid_3.2.3 xtable_1.8-2 gtable_0.2.0 DBI_0.3.1 magrittr_1.5 rex_1.1.1
[33] tools_3.2.3 purrr_0.2.2 crosstalk_1.0.0 parallel_3.2.3 yaml_2.1.13 colorspace_1.2-6 memoise_1.0.0 rJava_0.9-8
`

image

Moreover, at a different location in dashboard, I'm getting following error in conjunction with the above one... even though, I'm working with shiny 1.0...

image

Please let me know if you need any additional information regarding this.

Thanks
Nishant

multiInput(): set one column below the other

First of all, I really like the widget!
It's the user friendliest way I know to select and deselect items.

This is more a question than a issue: Is it possible to set the columns below each other instead of next to each other?

updatePickerInput encoding inconsistent with that of pickerInput

Hi

Thanks so much for the amazing package.

Please see the example below (I edited your example for pickerInput):

library(shiny)
library(shinyWidgets)

test = "Jean Mare’"
ui <- fluidPage(
    pickerInput(inputId = "somevalue", label = "A label", choices = test),
    verbatimTextOutput("value"),
    actionBttn('update', 'Update')
)
server <- function(input, output, session) {
    output$value <- renderPrint({ input$somevalue })
    observeEvent(input$update, {
        updatePickerInput(session = session, 
                          inputId = 'somevalue', 
                          choices = test)
    })
}
shinyApp(ui, server)

The issue as far as I can tell is the apostrophe http://www.fileformat.info/info/unicode/char/92/index.htm. However, I am wondering why pickerInput displays an unknown character box whereas updatePickerInput displays nothing. Both display:

[1] "Jean Mare<U+0092>"

in the verbatimTextOutput.

The encoding seems to be latin1 as below:

> test
[1] "Jean Mare'"
> Encoding(test)
[1] "latin1"

It does not end there though...

If I run that script directly in the console I get the above but if I create an app and run the script then pickerInput displays Jean Mare’ correctly and verbatimTextOutput displays the unknown character box [1] "Jean Mare�", while updatePickerInput displays the unknown character box and [1] "Jean Mare<U+0092>" in the verbatimTextOutput.

Finally, my app at https://elib.shinyapps.io/EncodingBug/ displays Jean Mare’ for both pickerInput and updatePickerInput and [1] "Jean Mare’" for verbatimTextOutput.

for comparison, the basic selectInput and updateSelectInput both display Jean Mare’ but [1] "Jean Mare�" in the verbatimTextOutput. A breakpoint for both displays:

Browse[2]> input$somevalue
[1] "Jean Mare’"

Here's the real problem for me. For pickerInput it displays the same above correctly but for updatePickerInput it displays:

Browse[2]> input$somevalue
[1] "Jean Mare\u0092"

That really is my biggest problem as I cannot use that value to get the relevant data. I could hard-code it in this case but thought there might be something more to it.

I am sorry this is so long but I decided to try be as comprehensive as possible. There may be OS differences at play too. I am using a Windows 10 64-bit.

Looking forward to hearing from you,
Eli

incompatibility between actionBttn and prettyRadioButtons

I can't seem to use both actionBttn and prettyRadioButtons in the same app. Looks like there could be an incompatibility between the libraries.

actionBttn followed by prettyRadioButtons

library(shiny)
library(shinyWidgets)

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

ui <- fluidPage(
  actionBttn(inputId = 'but1', label = 'but1'),
  prettyRadioButtons(inputId = 'rad1', label = 'rad1', choices = c(1,2,3), inline = TRUE, shape = 'square')
)

shinyApp(ui, server)

action-radio

prettyRadioButtons followed by actionBttn

library(shiny)
library(shinyWidgets)

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

ui <- fluidPage(
  prettyRadioButtons(inputId = 'rad1', label = 'rad1', choices = c(1,2,3), inline = TRUE, shape = 'square'),
  actionBttn(inputId = 'but1', label = 'but1')
)

shinyApp(ui, server)

radio-action

pickerInput not appearing within renderUI?

In the code below the checkboxGroupButtons() line works within renderUI(), but not the pickerInput() line.

library(shiny)
library(tidyverse)
library(forcats)

tmp <- tibble(Cat = c(rep("IV", 5), rep("III", 5)),
       Subcat = LETTERS[1:10])
tmp <- mutate(tmp, Cat = factor(Cat), Subcat = factor(Subcat))       

ui <- fluidPage(
       titlePanel(""),
   sidebarLayout(
      sidebarPanel(
         checkboxGroupButtons("Cat", "Category:", choices = levels(tmp$Cat), selected = levels(tmp$Cat)),
         uiOutput("Subcat")
      ),
   mainPanel(tableOutput("Table"))
   )
)

server <- function(input, output) {
   output$Subcat <- renderUI({
     tmp <- tmp %>% 
       filter(Cat %in% input$Cat) %>% 
       mutate(Subcat = fct_drop(Subcat))

     # pickerInput("what", label = "hello?", choices = levels(tmp$Subcat), selected = levels(tmp$Subcat), multiple = TRUE) #Does not appear
     checkboxGroupButtons("what", label = "hello?", choices = levels(tmp$Subcat), selected = levels(tmp$Subcat)) #Appears
   })

   output$Table <- renderTable({ filter(tmp, Cat %in% input$Cat, Subcat %in% input$what)})
   }

shinyApp(ui = ui, server = server)

multiInput() allow single choice only

This has completely replaced the original Shiny input widgets for me!

I have one question about your multiInput() widget. This is less of an "issue" but more of a "feature request". I really like the look of the two column selector. Is it possible to only allow 1 item selected (i.e. disable multiple). Although the name seems to imply "multiple", the UI of the two column view is very attractive.

I attempted to use shinyjs::disable() on it without success. Is it possible to have an option to only allow 1 choice selected and the selected choice displayed on the right? If a second choice is selected, then remove & replace the previously selected.

"updateCheckboxGroupButtons" not working when selected = NULL

I am trying to use updateCheckboxGroupButtons to update the buttons that are selected but when I do selected = NULL the buttons selected does not get updated. The previous buttons that were selected remains in the selection.

Following is a minimal example to reproduce the issue:

 library(shiny)
 library(shinyWidgets)
  
  
  ui <- fluidPage(
    
    selectInput(inputId = "SI_Element", label = "Element:", choices = c("Title", "Body")),
    
    checkboxGroupButtons(inputId = "CBK_Button", label = "Font Style:",
                         choices = c("bold", "italic", "underline")
                         , selected = c("bold"))
    
  )
  
  server <- function(input,output, session){
    
    observeEvent(input$SI_Element,{
      
      if(input$SI_Element == "Body"){
        updateCheckboxGroupButtons(session, "CBK_Button", selected = NULL)
      }else{
        updateCheckboxGroupButtons(session, "CBK_Button", selected = "bold")
      }
      
      
    })
    
  }
  
  shinyApp(ui = ui, server = server)

The output that is seen is a follows:
image

Using dropdown with leaflet: Strange behavior of input widgets

I get strange output when using dropdown with a leaflet map. The dropdown looks then something like this

bug

sliderInput and textInput behave very strangely when I add a leaflet map.

This is the code:

library(shiny)
library(leaflet)
library(shinyWidgets)
ui <- fluidPage(
  tabsetPanel(
    tabPanel("Karte",
      leafletOutput("map", height = "150px"),
      dropdown(
        textInput("Art", label = "Art"),
        sliderInput("Jahr", "Jahr", min = 2010, max = 2017,
          value = c(2012, 2017))
      )
    )
  )
)

server <- function(input, output, session) {
  output$map <- renderLeaflet({
    leaflet() %>% addTiles() %>% setView(11, 48, 12)
  })
}

shinyApp(ui, server)

pickerInput not work within a dropdownButton

If you try to open the select menu of a pickerInput within a dropdownButton, the dropdownButton collapses.

For example, this code does not work:

ui <- fluidPage(
  dropdownButton(
    pickerInput(inputId = "letters", label = "Letters",
                                 choices = LETTERS,
                                 options = list(title = "Select"),
                                 multiple = TRUE),
    circle = TRUE, status = "danger", icon = icon("sliders", lib = "font-awesome"), width = "300px",
    tooltip = tooltipOptions(title = "Drop Down"))
)
server <- function(input, output) {}
shinyApp(ui, server)

but this code does:

ui <- fluidPage(
  pickerInput(inputId = "letters", label = "Letters",
              choices = LETTERS,
              options = list(title = "Select"),
              multiple = TRUE)
)
server <- function(input, output) {}
shinyApp(ui, server)

awesomeCheckboxGroup does not get value when inline FALSE

Self explanatory example. awesomeCheckboxGroup does not get value when inline = FALSE. I have the latest version of shinyWidgets_0.3.6.

ui <- fluidPage(
    br(),
    awesomeCheckboxGroup(
      inputId = "id1", label = "Make a choice:",
      choices = c("graphics", "ggplot2")
    ),
    verbatimTextOutput(outputId = "res1"),
    br(),
    awesomeCheckboxGroup(
      inputId = "id2", label = "Make a choice:",
      choices = list("base" = "b", "dplyr" = "dp", "data.table" = "dt"),
      inline = TRUE, status = "danger"
    ),
    verbatimTextOutput(outputId = "res2")
  )
  
  server <- function(input, output, session) {
    
    output$res1 <- renderPrint({
      input$id1
    })
    
    output$res2 <- renderPrint({
      input$id2
    })
    
  }
  
  shinyApp(ui = ui, server = server)

Update: It does not work either on 0.3.5. However, it works on 0.3.4.

Does bootstrap have a reactive date picker?

Do you think there's a way to add adateInput picker to your package such that individual dates can use custom CSS to reactively show icons/specific values?

I'm basically trying to create something like the Google flights calendar that shows a value associated with each date
image

My plan for now is to use renderUI and change the CSS in one of your pickerInput select boxes. I'd love to contribute and create a proper calendar widget, but not even sure where to begin, have very limited jQuery knowledge.

Feature request, add width argument to awesomeRadio

Hi, very excited about the possibilities with this package. I want to use awesomeRadio and one of the options has a long text string that forces some unexpected display problems because I can't specify the width of the box similar to the width argument in the radioButtons function in shiny. Is it possible to add this to the function?

checkboxGroupButtons inside dropdownButton button does not work as expected

Hi,

Thank you for this amazing package.

I am trying to place a checkboxGroupButtons inside of a dropdownButton but the checkboxGroupbutton does not work as expected. I am not able to select more than one button at a time.

Following is a minimal example:

library(shiny)
library(shinyWidgets)
 
 ui <- fluidPage(
   
   dropdownButton(icon = icon("gear"), 
                  tooltip = tooltipOptions(title = "Settings"), circle = TRUE, status = "primary",
                  selectInput(inputId = "SI_Element", label = "Element:", choices = c("Title", "Body")),
                  selectInput(inputId = "SI_FontFam", label = "Choose Font Family:", 
                              choices = c("Sans", "Times New Roman"), selected = "Sans"),
                  numericInput(inputId = "Num_FontSiz", label = "Font Size:", value = 14, min = 1,max = 25),
                  checkboxGroupButtons(inputId = "CBK_Button", label = "Font Style:",
                                       choices = c(`<i class='fa fa-bold'></i>` = "bold", 
                                                   `<i class='fa fa-italic'></i>` = "italic", 
                                                   `<i class='fa fa-underline'></i>` ="underline"))
                  
   )
 )
 
 server <- function(input,output){
   
   
 }
 
 shinyApp(ui = ui, server = server)
  

sendSweetAlert no html option anymore

I was wondering why the HTML = T option on the sendSweetAlert function has been remove? Is there a solution to use the same code as before to have some html text display in the sweet alert?
Also, is it possible not to close the alert when we click outside the popup?
Thanks

add class to dropdownButton?

Hi,

The default size of dropdownButton seems to be too large, and btn-lg was automatically added to the component. Is it possible to allow class like small / large / x-small / x-large to that user can decide the size to go with?

updateRadioGroupButtons does not reset

Hey Victor,

you already helped me with the sentiment input. Now I tried to update this button or better reset. But updateRadioGroupButtons(session, "sent", selected = "") updates only the UI and not the value itself. Do you know how to fix this? character(0) instead of "" an empty string does not seem to be the solution.

Thanks in Advance,
Simon

different colors for radioGroupButtons

Hi folks, first you've created a wonderful package with dozens of features that I frequently use. Thanks for that! In one application I want to measure the sentiment of a given tweet.

radioGroupButtons(
    inputId = "sent", 
    label = h3("Sentiment"), 
    choiceValues = -2:2, 
    choiceNames = paste0(-2:2),
    justified = T
)

The result is well known:

screenshot 2018-01-09 17 16 49

(-2 is active)

But the coloring I'm looking for is

screenshot 2018-01-09 17 16 49 kopie

Do you know how to tweak the code to get a kind of result?
Thanks in advance!
Simon

Material Switch div error

Hi, the latest commit b0286f78 produces an error with material switch widgets. Head of stack trace:

Warning: Error in .tag_validate: class is: form-group shiny-input-container material-switch, needs to be: form-group shiny-input-container
Stack trace (innermost first):
    121: .tag_validate
    120: shinyInput_label_embed
    119: function_list[[k]]
    118: withVisible

I do wrap widgets with div() so that I can use shinyjs::reset(). Thank you.

Tooltips

Congrats for the great package!

I was wondering whether there could be support for tooltips for all widgets, not only the drop-down menu. Popular packages to add tooltips to Shiny, such as bsplus, work only for certain ShinyWidgets (e.g. materialSwitch) but not for others (e.g. pickerInput).

Thanks

Is it possible to renderUI on a pickInput within a dropdownbutton

Firstly thank you for sharing - this is an excellent package. I'm hoping the answer to my question below is easy, as it has me a little stumped due to little knowledge of how the jQuery is being built up.

I've setup a dropdownButton and want to be able to use the p

dropdownButton(
              "Select adverts to drill down",
              circle = TRUE, status = "default", icon = icon("sliders"), width = "300px",
              tooltip = tooltipOptions(title = "Click to see inputs !"),
              uiOutput("choose_adverts")
            )

I want to be able to render a pickerInput in this box, with dynamically updated list of choices

pickerInput(inputId = "Adverts", 
               label = "Adverts",
              choices = adverts, # a list of strings
               options = list(`actions-box` = TRUE, `live-search` = TRUE), 
              multiple = TRUE)

It currently renders the picker but does not populate choices.

Are you able to suggest what I might try to get it to work?

use reset button of searchInput in server()

Hello !

Would it be possible to access the reset button of the searchInput as a proper input ?
I would like to attach an event to it other than just reseting the searchfield, using observeEvent.
On the simpliest form, it would be something like so :

library(shiny)
library(shinyWidgets)

ui <- fluidPage(
  sidebarLayout(
    sidebarPanel(
      textInput(inputId="text", value=NULL),
      searchInput(inputId ="search", value=NULL)
    )
  )
)

server <- function(input, output) {
  observeEvent(search$reset){
    updateTextInput("text", value = "RESET!")
  }
}

shinyApp(ui = ui, server = server)

Maybe is it only possible in Jquery ?

Thanks !

Unable to use "." in inputId of pickerInput() when rendering with renderUI()

Using a '.' in your pickerInput inputId, when using renderUI to render the pickerInput, results in the pickerInput dropdown menu not showing up. The default value is evaluated and it does show up in the shiny.reactlog, however.
I have made a demo to show this behavior:

library(shiny)
library(shinyWidgets)

# Define UI for application that draws a histogram
ui <- fluidPage(
   
   # Application title
   titlePanel("Old Faithful Geyser Data"),
   
   # Sidebar with a slider input for number of bins 
   sidebarLayout(
      sidebarPanel(
      	uiOutput("picker1"),
      	uiOutput("picker2")
      ),
      
      # Show a plot of the generated distribution
      mainPanel(
         plotOutput("distPlot")
      )
   )
)

# Define server logic required to draw a histogram
server <- function(input, output) {
  output$picker1 <- renderUI({
        #Renders
  	pickerInput(inputId = "old_faithfull",
	    label = "Bins",
	    choices = 1:10)
  })
  
  output$picker2 <- renderUI({
        #Does not render
  	pickerInput(inputId = "old.faithfull",
	    label = "Times",
	    choices = 1:2)
  })
	
   output$distPlot <- renderPlot({
      # generate bins based on input$bins from ui.R
      x    <- faithful[, 2] 
      bins <- seq(min(x), max(x), length.out = as.numeric(input$old_faithfull)*as.numeric(input$old.faithfull) + 1)
      
      # draw the histogram with the specified number of bins
      hist(x, breaks = bins, col = 'darkgray', border = 'white')
   })
}

# Run the application 
shinyApp(ui = ui, server = server)
> sessionInfo()
R version 3.4.0 (2017-04-21)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 14.04.5 LTS

Matrix products: default
BLAS: /usr/lib/openblas-base/libblas.so.3
LAPACK: /usr/lib/lapack/liblapack.so.3.0

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8   
 [6] LC_MESSAGES=en_US.UTF-8    LC_PAPER=en_US.UTF-8       LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] shinyWidgets_0.2.0 shiny_1.0.3       

loaded via a namespace (and not attached):
 [1] compiler_3.4.0  R6_2.1.3        htmltools_0.3.6 tools_3.4.0     Rcpp_0.12.11    jsonlite_1.5    digest_0.6.12   xtable_1.8-2    httpuv_1.3.3   
[10] mime_0.5

Very strange bug, took me a while to figure out what was going on ;).
I haven't tested any of the other widgets for this bug.

switchInput() does nor work under specific conditions

Hi; first of all, thank you very much for shinyWidgets; thanks to it I am building quite fast a rather complex website; first testing it locally, and then uploading the app to my own server in AWS.

The thing is, I have observed that the function switchInput() not always work, and instead the website renders a default Shiny checkbox (that is not reactive; it can be checked / unchecked, but it doesn't trigger the desired action).

After some experimentation, what I have observed is:

  • switchInput() does work locally, but not in the AWS server. I have tried with a couple of virtual machines, and the bug seems reproducible.
  • Also, to observe the malfunction of switchInput(), I have to run it in an AWS server AND inside a renderUI() function. If I code a switchInput() in ui.R instead that in server.R, everything is ok.
  • Last, it happens that the rest of the functions of shinyWidgets work perfectly, wheter in local or in the cloud, inside or outside renderUI(). I haven't been exhaustive, but dropdown menus, checkboxgroup or buttons do work.

materialSwitch() also works fine, so I have a fancy substitute for switchInput(). Anyway, I thought that you would like to try to reproduce my observations.

prettyToggle resets actionBttn design

Hi!

Your package is really super awesome!

Please see the example below.

While using prettyToggle and actionBttn in one app, the design of the button is like resetted (not sure if it's the proper word - image below)

obraz

However when I delete prettyToggle from the app, the actionBttn looks nice
obraz

Why is it like that?
Here is the code, just basic.

library(shiny)
library(shinyWidgets)

ui <- fluidPage(
  # prettyToggle(inputId = "toggle1",
  #              label_on = "Checked!",
  #              label_off = "Unchecked..."),
 actionBttn('button','Button', style='gradient')
  
)

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

}
shinyApp(ui, server)

Thank you
Marta

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.