Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Customize `sliderInput()` appearance

Tags:

r

shiny

I want to use sliders as "likert-type questions" when using shiny as a survey tool.
Therefore I want to customize the caption of the ends of the slider to somewhat like "I totaly aggree" and "I totally disagree". Is there a smooth way for doing that?

like image 690
sammerk Avatar asked Sep 14 '26 02:09

sammerk


1 Answers

do you want something like this? Make sure to adjust your width accordingly

library(shiny)
ui <- fluidPage(
  sliderInput('slider', 
              label = div(style='width:500px;', 
                          div(style='float:left;', 'I totally disagree'), 
                          div(style='float:right;', 'I totaly aggree')), min = 0, max = 10, value = 7, width = '500px')

)

server <- function(input, output) {}
shinyApp(ui, server)

enter image description here

like image 55
Pork Chop Avatar answered Sep 17 '26 06:09

Pork Chop



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!