View source: R/grid-column-renderer.R
| grid_col_checkbox | R Documentation | 
Display checkboxes in grid's column
grid_col_checkbox(
  grid,
  column,
  class = "form-check d-flex justify-content-center my-1",
  ...
)
| grid | A table created with  | 
| column | The name of the column where to create buttons. | 
| class | CSS classes to add to checkbox container. | 
| ... | Further arguments passed to  | 
A datagrid htmlwidget.
library(toastui)
library(shiny)
library(bslib)
ui <- fluidPage(
  theme = bslib::bs_theme(version = 5L),
  tags$h2("Checkbox column grid demo"),
  fluidRow(
    column(
      width = 8,
      datagridOutput("grid"),
      verbatimTextOutput("edited")
    )
  )
)
server <- function(input, output, session) {
  output$grid <- renderDatagrid({
    data.frame(
      month = month.name,
      checkboxes = sample(c(TRUE, FALSE), 12, replace = TRUE),
      switches = sample(c(TRUE, FALSE), 12, replace = TRUE)
    ) %>%
      datagrid(data_as_input = TRUE) %>%
      grid_col_checkbox(column = "checkboxes") %>%
      grid_col_checkbox(
        column = "switches",
        # /!\ will only works with bslib::bs_theme(version = 5L)
        class = "form-check form-switch d-flex justify-content-center my-1"
      )
  })
  output$edited <- renderPrint({
    input$grid_data # outputId + "_data
  })
}
if (interactive())
  shinyApp(ui, server)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.