I have a shiny app where I am using a shinyWidgets::sliderTextInput() slider to select a numeric value, but the scale is a bunch of consecutive numbers, then one quite far away. (In my case, it's select a year out of 2000-2010, or 2050).
Is there a way to use css to add visual space between two specific ticks on a shiny slider? In the reprex below, I use the default histogram shiny to select number of bins out of c(1:30,50). Here, I'd like the slider bar to show ticks 1:30 evenly spaced, then some sort of visual gap between the last two ticks (30 and 50) just to visually make it clear those are not consecutive. That space doesn't have to be 20 units long (the actual numerical difference), just an extra bit to help the user notice the difference.
I don't want to add in a "NA" to my selection vector because I don't want the space between those ticks to be selectable.
Based on Chrome web inspector, I know it has to do with object class irs-grid and irs-grid-pol, but I can't figure out how to change the spacing of those.
Thanks in advance!
reprex:
library(shiny)
# 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(
shinyWidgets::sliderTextInput(
inputId = "bins",
label = "Number of bins:",
selected = 20,
choices = c(1:30, 50),
grid = TRUE
),
),
# Show a plot of the generated distribution
mainPanel(
plotOutput("distPlot")
)
)
)
# Define server logic required to draw a histogram
server <- function(input, output) {
output$distPlot <- renderPlot({
# generate bins based on input$bins from ui.R
x <- faithful[, 2]
bins <- seq(min(x), max(x), length.out = input$bins + 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)