Is there a way to render html tags inside reactable in shiny

25 Views Asked by At

I am trying to render HTML tags inside reactable in shiny. However the below example is not a shiny table . I have only kept the table to reduce the code.

Well I am not able to render the button here. It is showing as HTML tags only. Is there a way to render the button here

iris$new <- HTML('<html>
<body>

<button type="button" onclick="alert("Hello world!")">Click Me!</button>
 
</body>
</html>')

hidden_Columns = c('new', 'Species')

reactable(class = "rt", rownames = F, columns = c(list(
  #ht = colDef(html = TRUE), 
  name = colDef(html = TRUE,width = 1000,
                filterable = TRUE)),lapply(setNames(hidden_Columns, hidden_Columns), function(x){x = colDef(show =F)})),
  defaultColDef = colDef(show = T), iris, details = function(index) {
    htmltools::div(tags$style("table {
  font-family: arial, sans-serif;
  border-collapse: collapse;
  margin: 40px;
}

td, th {
  border: 1px solid #dddddd;
  text-align: left;
  padding: 2px;
}


tr:nth-child(even) {
}"),tags$table(tags$tr(
  tags$th('Species'),
  tags$th('new')
)
,tags$tr(
  tags$td(iris[index,][['Species']]),
  tags$td(iris[index,][['new']])
)))
    
  })

enter image description here

0

There are 0 best solutions below