Skip to content

Appsilon/reactable.extras

Repository files navigation

reactable.extras reactable.extras logo

Extra features for reactable package

CRAN status R-CMD-check Codecov test coverage

reactable.extras is an R package that enhances the functionality of the reactable package in Shiny applications. Reactable tables are interactive customizable, and reactable.extras extend their capabilities, allowing you to create dynamic and interactive data tables with ease.

In the context of web apps, you often need to provide users with additional tools and interactivity for data exploration. reactable.extras address this need by offering a set of functions and components that can be seamlessly integrated into your Shiny apps.

How to install?

Stable version:

install.packages("reactable.extras")

Development version:

remotes::install_github("Appsilon/reactable.extras")

How to use it?

Getting started with reactable.extras is straightforward:

  1. Make sure you have latest version of {reactable}. It's required to be at least on version 0.4.0
  2. Include the necessary functions and components in your Shiny UI definition.
  3. Use the provided functions to enhance your reactable tables. You can add custom buttons, checkboxes, date pickers, dropdowns, and text inputs to your table cells.
  4. Customize the behavior and appearance of these input components based on your application's requirements.
  5. Implement server-side processing and pagination controls for large datasets.
library(shiny)
library(reactable)
library(reactable.extras)

data <- data.frame(
  ID = 1:1000,
  SKU_Number = paste0("SKU ", 1:1000),
  Actions = rep(c("Updated", "Initialized"), times = 20),
  Registered = as.Date("2023/1/1")
)

ui <- fluidPage(
  # Include reactable.extras in your UI
  reactable_extras_dependency(),
  reactableOutput("my_table")
)

server <- function(input, output, session) {
  output$my_table <- renderReactable({
    # Create a reactable table with enhanced features
    reactable(
      data,
      columns = list(
        ID = colDef(name = "ID"),
        SKU_Number = colDef(name = "SKU_Number"),
        Actions = colDef(
          name = "Actions",
          cell = button_extra("button", class = "btn btn-primary")
        ),
        Registered = colDef(
          cell = date_extra("Registered", class = "date-extra")
        )
      )
    )
  })

  observeEvent(input$button, {
    showModal(modalDialog(
      title = "Selected row data",
      reactable(data[input$button$row, ])
    ))
  })

}

shinyApp(ui, server)

How to contribute?

If you want to contribute to this project please submit a regular PR, once you're done with new feature or bug fix.

Reporting a bug is also helpful - please use GitHub issues and describe your problem as detailed as possible.

Appsilon

Appsilon is a Posit (formerly RStudio) Full Service Certified Partner.
Learn more at appsilon.com.

Get in touch [email protected]

Explore the Rhinoverse - a family of R packages built around Rhino!

Subscribe for Shiny tutorials, exclusive articles, R/Shiny community events, and more.