reactable icon indicating copy to clipboard operation
reactable copied to clipboard

output as raw html - New feature request

Open algo-se opened this issue 3 years ago • 3 comments

Hi @glin, first congratulations on reactable, I´m loving it. I think it is hands down the best R package to get good looking tables.

I´ve been using reactable with Shiny and it´s just great, but then I´ve tried to use it with blastula and it does not work. However, you can use gt pkg to display HTML tables in blastula beacuse it has a function, as_raw_html() that returns the raw HTML with all the styles inlined.

Would it be posible to add something similar to reactable? I´d really rather use it instead of gt.

Thank you for your work. Best regards, Alejandro.

algo-se avatar Oct 07 '20 07:10 algo-se

I second this. I would love to send automated emails with gmailr using reactable tables.

mattwarkentin avatar Oct 07 '20 15:10 mattwarkentin

Hi, thanks for the feedback!

I think this is technically possible, but really tough to do, and probably not worth the effort. reactable is rendered entirely via JavaScript, so you'd have to run a headless browser or something like Node.js to generate the HTML. The external table CSS would also have to be converted to inline styles, which is another challenge.

If you want to embed reactable in an email, I would recommend taking a screenshot instead. Or using something like webshot2 to take screenshots automatically: https://github.com/glin/reactable/issues/67#issuecomment-674581250

Alternatively, you can save the table to a file using htmlwidgets::saveWidget() or by rendering a separate Rmd, and attach the file using blastula::add_attachment().

reactable, like other HTML widgets, are heavily dependent on JavaScript for rendering and interactivity. Since most email clients don't allow running JavaScript (including gmail), reactable wouldn't work in an email even if you had the raw HTML. If you just need tables in an email, I'd recommend using a pure HTML table like gt. If you need interactive tables or HTML widgets, I'd suggest attaching or linking to an external page.

glin avatar Oct 10 '20 20:10 glin

Thank you for the detailed answer. I'll try all the things you've suggested.

algo-se avatar Oct 11 '20 09:10 algo-se