SliderInput in Shiny - how to control slider length / width in shiny?

When I use the sliderInput function in brilliant form, it seems to me that I can not control the width / length of the slider. By default, the slider takes up the entire width of the page (in basicPage mode, not in pageWithSidebar mode). I am wondering if there is a way to control the width of the slider. Thanks for any suggestions.

+4
source share
2 answers

You can add a style tag in the ui.r tag:

tags$head( tags$style(type="text/css", ".jslider { max-width: 200px; }") ), 

Put these lines inside shinyUI (), and you can change the width of the sliderinput.

UPDATE:
From Shiny 0.11, RStudio switched from jslider to irs ( http://cran.r-project.org/web/packages/shiny/NEWS ):

Changed the sliders from jquery-slider to ion.rangeSlider. These sliders have an improved appearance, support the update of additional properties from the server, and it can be controlled using keyboard input. What does it mean .jslider will no longer work.

Replace with .irs {max-width: 200px;} should work.

+8
source

The error response did not work for me. However, sliderInput() has an argument of width=NULL , which is documented as follows:

Slider width, for example, "400px" or "100%"; see validateCssUnit.

Setting it to 100% creates a sliderInput spannign of the entire string, etc.

0
source

Source: https://habr.com/ru/post/1484905/


All Articles