Questions tagged [shinyjs]

shinyjs is an R package that lets you perform common useful JavaScript operations in Shiny applications without having to know any JavaScript. This is turn allows you to easily improve the user interaction and user experience in your Shiny apps. It can also be used to easily run your own custom JavaScript functions from R.

shinyjs lets you perform common useful JavaScript operations in Shiny apps that will greatly improve your apps without having to know any JavaScript.

Examples include: hiding an element, disabling an input, resetting an input back to its original value, delaying code execution by a few seconds, and many more useful functions for both the end user and the developer. shinyjs can also be used to easily call your own custom JavaScript functions from R.

Useful resources:

637 questions
47
votes
3 answers

Possible to show console messages (written with `message`) in a shiny ui?

I don't understand R's message vs cat vs print vs etc. too deeply, but I'm wondering if it's possible to capture messages and show them in a shiny app? Example: the following app can capture cat statements (and print statements as well) but not…
DeanAttali
  • 25,268
  • 10
  • 92
  • 118
20
votes
3 answers

Shiny Dashboard - display a dedicated "loading.." page until initial loading of the data is done

I have initial loading of data from the DB in the server.R which takes a few seconds. Until this is done, the page displayed is distorted (wrong data in selection box, and weird placing of the boxes, see below). I want to display a different page…
KeshetE
  • 385
  • 2
  • 5
  • 17
19
votes
3 answers

Restart Shiny Session

This seems like a very obvious question but I haven't found anything on the subject. How can I refresh a shiny application (the equivalent of pressing F5, or clicking the "Reload App" button in RStudio)? ui.R shinyUI(pageWithSidebar( …
Hamilton Blake
  • 622
  • 1
  • 6
  • 19
18
votes
3 answers

Draggable line chart in R/Shiny

I have built an R/Shiny app which uses linear regression to predict some metrics. In order to make this app more interactive, I need to add a line chart, where I can drag the points of the line chart, capture the new points and predict the values…
savita
  • 197
  • 1
  • 3
15
votes
5 answers

conditionally output different colored text in Shiny

I would like Shiny to print out some different color text depending on the size of a vector. I was thinking something like: output$some_text <- renderText({ if(length(some_vec) < 20){ paste("This is red text")
tumultous_rooster
  • 12,150
  • 32
  • 92
  • 149
12
votes
4 answers

How to collapse sidebarPanel in shiny app?

I have a shiny app with a mainPanel and a sidebarPanel inside a tabPanel in a navbarPage. I need an option to hide the sidebarPanel similar to this: Hide sidebar in default in shinydashboard and https://github.com/daattali/shinyjs/issues/43. An…
needRhelp
  • 2,948
  • 2
  • 24
  • 48
12
votes
1 answer

How to programmatically collapse a box in shiny dashboard

I'm trying to collapse a box programmatically when an input changes. It seems that I only need to add the class "collapsed-box" to the box, I tried to use the shinyjs function addClass, but I don't know how to do that becuase a box doesn't have an…
Geovany
  • 5,389
  • 21
  • 37
11
votes
4 answers

shiny: start the app with hidden tabs, with NO delay

I would like to build an application and some of the tabs will be hidden to the user until he types the right password. I know how to do this with shinyjs::hideTab: library(shiny);library(shinyjs) ui <- fluidPage(useShinyjs(), navbarPage("hello",…
agenis
  • 8,069
  • 5
  • 53
  • 102
11
votes
2 answers

Show/hide entire box element in R Shiny

I'm currently trying to find a way to hide/show an entire box() element (and everything inside) in R Shiny. I want to create a maybe a button which allows the user to expand a specifict box and then to hide it with the same (or even different)…
Yordan Ivanov
  • 329
  • 1
  • 3
  • 14
11
votes
1 answer

Dynamically show/hide input with shinyjs and flexdashbord

Trying to update Sidebar in flexdashboard when click on a tab. Can't get it to work. --- title: "Test Sidebar" output: flexdashboard::flex_dashboard: orientation: rows runtime: shiny --- ```{r…
iboboboru
  • 1,112
  • 2
  • 10
  • 21
11
votes
1 answer

disabling/enabling sidebar from server side

Is there any way to manually disabling/enabling the sidebar on shiny dashboard app from the server side? I would like to hide the sidebar automatically when I need more space without using toggle button on the header. Thank you
Geovany
  • 5,389
  • 21
  • 37
11
votes
1 answer

capturing cat output periodically for R shiny output (renderPrint)

Hope someone can help me with this. Let's say there is a function "example" which is something like ##function from a package example<-function(f){ #does something cat("step 1 done....") # etc etc cat("step 2…
dlow
  • 111
  • 4
10
votes
1 answer

R Shiny: Use Onclick Option of Actionbutton on the Server Side

I want to make a Shiny App in which the user can press an actionbutton which would then trigger some code on the server side creating a file in the www folder and then opens/downloads the file. Suppose the file is test.txt (in my case it would be a…
JesperHansen
  • 437
  • 1
  • 4
  • 16
10
votes
2 answers

shiny app : disable downloadbutton

My shiny app produces some files that user can download. I have put downloadbutton in the ui for this purpose. However, when the page launches and before any calculation is done, there is nothing to download. I want to prevent user from downloading…
Elaheh kamaliha
  • 753
  • 2
  • 8
  • 17
9
votes
2 answers

How to create On load Event or default event in shiny?

I am new to shiny as well as stackoverflow and looking for some help with a problem that I am currently stuck at. I am trying to build a shiny app which collects some inputs from the user and creates visualization based on inputs on click of a…
WiseChirag
  • 187
  • 2
  • 9
1
2 3
42 43