When i use the sliderInput function in shiny it seems like I am not able to control the width/length of the slider. By default, the slider occupies the entire width of the page (in basicPage mode, not in the pageWithSidebar mode). I am wondering if there is some way to control the width of the slider. Thanks for any suggestions.
It is possible to add a style tag in ui.r:
tags$head(
tags$style(type="text/css", ".jslider { max-width: 200px; }")
),
Place these lines inside shinyUI() and the width of the sliderinput can be adjusted.
UPDATE:
With Shiny 0.11 RStudio switched from jslider to irs (http://cran.r-project.org/web/packages/shiny/NEWS
):
Changed sliders from jquery-slider to ion.rangeSlider. These sliders have an improved appearance, support updating more properties from the server, and can be controlled with keyboard input. Which means .jslider won't work any more.
Change to .irs {max-width: 200px;} should work.
Timrors answer did not work for me. However, there is an argument width=NULL
in sliderInput()
, which is documented as follows:
The width of the sliderInput, e.g. '400px', or '100%'; see validateCssUnit.
Setting it to 100%
creates a sliderInput spannign the entire row, etc.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With