I'm working on a Shiny app that enables folk to browse some time series data. I have a number of widgets that enable people to select variables and type of analysis. In between, I have a modest radioButton
mechanism that allows users to select time series for some variables:
radioButtons("radio_year_select","Year", c("1999" = "1999", "2001" = "2001"))),
The code generates a simple widget:
In the context of this particular application, I would like to have the options presented in a horizontal order, like that:
Year: [X]1999 [ ]2001
Is there a simple way to achieve that?
Vertical positioning of radio buttons is safer. Try to lay out your lists vertically, with one choice per line. If you still need a horizontal layout with multiple options per line, make sure to space the buttons and labels so that it's absolutely clear which choice goes with which label.
By default, checkboxes and radio buttons are displayed in vertical format. You can change the appearance to be horizontal instead using a Custom CSS Class. The default vertical display is recommended.
How do you make a radio button group horizontal? Drag a radio list widget to your screen, go to the Properties tab and select 'Orientation' -> Horizontal.
Add inline=TRUE
radioButtons("radio_year_select","Year", c("1999" = "1999", "2001" = "2001"), inline=T)
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