bslib icon indicating copy to clipboard operation
bslib copied to clipboard

Add `input_check_buttons()` and `input_radio_buttons()`

Open cpsievert opened this issue 1 year ago • 0 comments

Supersedes #485. Here's a hello world example.

library(shiny)
library(bslib)

ui <- page_fixed(
    input_check_buttons("x", state.name[1:3], selected = state.name[1:3]),
    input_radio_buttons("y", state.name[1:3]),
    input_check_buttons("z", state.name[1:10], gap = 8)
)
server <- function(input, output, session) {
    observe({
        print(input$x)
        print(input$y)
        print(input$z)
    })
}

shinyApp(ui, server)

TODO

  • [ ] Add a label argument?
  • [ ] Should we support I("all")/I("none")? Take inspiration from radioButtons()/checkboxGroupInput()?
  • [ ] Should we support size = c("sm", "md", "lg")?
  • [ ] How to specify (require?) aria-label
  • [x] Do we need to tell shiny not to bind to the inputs?
  • [ ] Consider wrapping logic up in web component

cpsievert avatar Sep 12 '23 21:09 cpsievert