Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export an interactive table that's static? #17

Open
kszlim opened this issue Sep 10, 2024 · 2 comments
Open

Export an interactive table that's static? #17

kszlim opened this issue Sep 10, 2024 · 2 comments

Comments

@kszlim
Copy link

kszlim commented Sep 10, 2024

Ie. have no backend, but allow export of a static html file that is interactive.

Even better if you don't need to embed the data as json or something within the document but instead can sidecar it as a parquet file or something (this might require duckdb wasm or something).

@machow
Copy link
Owner

machow commented Sep 10, 2024

Hey, thanks for raising this issue -- you should be able to export the table into a static html file. For example, the reactable-py documentation is a static site, generated with quarto.

You should be able to run quarto render example.qmd on a file like this...

example.qmd

---
title: example
jupyter: python3
--- 

```{python}
from reactable import Reactable, embed_css
from reactable.data import cars_93

embed_css()

Reactable(cars_93)
```

Here's what the resulting html file looks like for me. I think some resources are still currently pulled from a CDN, so it's not totally self-contained, but no webserver is needed.

image

Does that do what you're looking to do?

@dhimmel
Copy link

dhimmel commented Dec 3, 2024

This is pseudocode what I'm currently using in my .qmd file:

```{python}
#| echo: false
#| output: asis
from reactable import embed_css
from my_package import get_reactable

embed_css()
get_reactable()
```

I found output: asis helps with an issue where the file size is about 4x too large because the table gets inserted multiple times.

I'm curious if there's a way to get the HTML Reactable would like to insert as a string for more control over the insertion or for use outside or quarto?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants