How can I remove the column of radio buttons from a reactable table in my Shiny app, but keeping the selection = "single"
argument?
My reprex is based on this solution to hiding the all/none checkbox with selection = "multiple"
, I was hoping that I could do something similar to remove the radio buttons.
app.R
:
library(shiny)
library(reactable)
ui <- fluidPage(
includeCSS("hide_radio.css"),
titlePanel("Hide radio buttons"),
mainPanel(reactableOutput("table"))
)
server <- function(input, output) {
output$table <- renderReactable({
reactable(
mtcars,
selection = "single",
columns = list(
.selection = colDef(
headerStyle = list(pointerEvents = "none")
)
),
theme = reactableTheme(
headerStyle = list("& input[type='checkbox']" = list(display = "none"))
)
)
})
}
shinyApp(ui = ui, server = server)
hide_radio.css
:
.hide-checkbox {
pointer-events: none;
}
.hide-checkbox input[type='checkbox'] {
display: none;
}