I'd like to align some radioGroupButtons()
from shinyWidgets
into 5 equally spaced columns. I'd also like the buttons to all have the same width. The column widths work a little better if I use direction = "vertical"
but the columns end up even further away from each other. Here's what it looks like as-is.
Maybe the answer is hidden here but I couldn't figure it out.
library(shiny)
library(shinyWidgets)
my_css <-
".btn-group, .btn-group-vertical {
column-count: 5;
}"
ui <-
fluidPage(
tags$head(tags$style(HTML(my_css))),
radioGroupButtons(
inputId = "somevalue1",
label = NULL,
choices =
setNames(
1:20,
rep(c("xs", "medium", "very long", "a whole lotta text"), 5)
)#, direction = "vertical"
)
)
server <- function(input, output) {}
shinyApp(ui, server)
You can have everything with the same width by playing with the CSS of the classe btn-group-toggle and radiobtn.