Goal
Enable individual components (like a chart, table, or text block) or entire Preswald applications to be rendered inside an iframe — so that Preswald apps can be embedded inside other websites, dashboards, or internal portals.
📌 Motivation
Preswald is great for building interactive dashboards and data apps — but sometimes users want to embed a portion of that functionality inside another product, portal, or web app. For example:
- Embedding a live Plotly chart inside a documentation site
- Sharing a single
table() or text() component in a blog
- Hosting a full Preswald app as a widget in a CMS or web portal
- Surfacing Preswald apps inside enterprise tools (Jira, Notion, Slack apps)
This makes Preswald more modular, composable, and shareable.
✅ Acceptance Criteria
🛠 Implementation Plan
1. Component Embedding Route
- Add
/embed/<component_id> endpoint to backend
- Strip layout/chrome and render only that one component
- Optionally support multiple component IDs or sections
2. Full App Embedding Mode
- When
embed = true, load a reduced shell layout:
- No side nav, branding, or toolbars
- Fit nicely into iframe with auto-sizing support
3. Developer Tools
- Log or print iframe snippet at boot time:
ℹ️ Embed this chart in your blog:
<iframe src="http://localhost:8501/embed/chart-xyz123" width="600" height="400" />
🧪 Testing Plan
- Build a simple app with:
plotly(fig, id="main_chart")
table(df, id="my_table")
- Run:
- Open:
http://localhost:8501/embed/main_chart
http://localhost:8501/embed/my_table
- Validate:
- Renders correctly inside iframe
- CSS is scoped and responsive
- CORS and X-Frame headers are correct
📚 Docs To Add
🧩 Related Files
preswald/server_service.py → route: /embed/<component>
frontend/src/pages/EmbedView.jsx (new)
preswald.toml:
[deployment]
embeddable = true
Goal
Enable individual components (like a chart, table, or text block) or entire Preswald applications to be rendered inside an iframe — so that Preswald apps can be embedded inside other websites, dashboards, or internal portals.
📌 Motivation
Preswald is great for building interactive dashboards and data apps — but sometimes users want to embed a portion of that functionality inside another product, portal, or web app. For example:
table()ortext()component in a blogThis makes Preswald more modular, composable, and shareable.
✅ Acceptance Criteria
--embedflag topreswald runorpreswald exportembed = trueoption topreswald.tomlor per-component setting//embed/<component_id>X-Frame-Options: ALLOWALLContent-Security-Policywithframe-ancestors🛠 Implementation Plan
1. Component Embedding Route
/embed/<component_id>endpoint to backend2. Full App Embedding Mode
embed = true, load a reduced shell layout:3. Developer Tools
🧪 Testing Plan
http://localhost:8501/embed/main_charthttp://localhost:8501/embed/my_table📚 Docs To Add
docs/deployment/embedding.mdx<iframe>in Notion, Hugo, Docusaurus🧩 Related Files
preswald/server_service.py→ route:/embed/<component>frontend/src/pages/EmbedView.jsx(new)preswald.toml: