Skip to content

[Feature]: render HTML in button_extra #55

@stla

Description

@stla

Guidelines

  • I agree to follow this project's Contributing Guidelines.

Description

Hello,

I want to use button_extra with some HTML inside the buttons. However that doesn't work, even with html=TRUE in colDef. If I remove cell = button_extra(..., the HTML is correctly rendered, but with cell=button_extra(..., the HTML code appears inside the buttons.

library(shiny)
library(reactable)
library(reactable.extras)
library(fontawesome)

df <- MASS::Cars93[, 1:4]
df$view_item <- '<i class="fa-solid fa-eye"></i>'

ui <- fluidPage(
  reactable_extras_dependency(),
  fa_html_dependency(),
  reactableOutput("table")
)

server <- function(input, output, session) {

  output$table <- renderReactable({
    reactable(
      df,
      columns = list(
        view_item = colDef(
          html = TRUE,
          cell = button_extra(id = "button", class = "button-extra")
        )
      )
    )
  })
  
  observe({
    print(input$button)
  })
  
}

shinyApp(ui, server)

Problem

The problem is that the HTML code is rendered inside the button.

Proposed Solution

I have no idea about the solution.

Alternatives Considered

I don't know whether there are some alternatives.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions