Skip to content

Add Component Embedding Feature #736

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

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

sambhavnoobcoder
Copy link

Description of Changes
This PR adds the ability to embed individual Preswald components or entire applications in external websites. Users can now:

  1. Embed specific components by their ID using iframe tags
  2. Specify which component to embed via the component_id parameter
  3. View embedded components with proper styling and minimal UI clutter
  4. Handle errors gracefully when embedding nonexistent components

The implementation includes server-side changes to filter components by ID, frontend changes to support embed mode, and extensive test coverage to ensure reliability.

Related Issue
Fixes #536

Type of Change

  • New feature (non-breaking change which adds functionality)
  • Documentation update
  • New example
  • Test improvement

Testing
I've created comprehensive tests in tests/embed_test.py that verify:

  • Component registration with embed mode
  • Handling of nonexistent components
  • Broadcasting components to clients
  • Client unregistration and connection cleanup

All tests pass successfully. I've also manually tested embedding components in the provided example HTML file.

image

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have run my code against examples and ensured no errors
  • Any dependent changes have been merged and published in downstream modules

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

Successfully merging this pull request may close these issues.

[FEATURE] Make Preswald Components and Apps Embeddable in External Platforms (via iframe)
1 participant