How about using ShinyWidget's radioGroupButtons
?
library(shiny)
library(shinyWidgets)
ui <- fluidPage(
radioGroupButtons(
inputId = "choice",
label = "Choice: ",
choices = c("Option 1", "Option 2"),
selected = "Option 1",
individual = T
),
textOutput("selected_choice")
)
server <- function(input, output, session) {
output$selected_choice <- renderText({
paste("Selected:", input$choice)
})
}
shinyApp(ui, server)