The HTML Embed component enables the direct integration of custom HTML, CSS, and JavaScript code into your Webstudio project. With this component, you can extend the capabilities of your website, create interactive widgets, integrate external APIs, and implement personalized interactions.
The "HTML Embed" component can be found in Components > General, and you can place it on your canvas by dragging and dropping it or clicking it in the Components panel.
You can add your custom HTML, CSS, or JavaScript code to the HTML Embed instance by selecting it and accessing its “Settings”.
The "Code" section has a text area for adding your custom code. After you paste your code here, it will be rendered on the canvas. You can add anything to your site including custom widgets, third-party services, API integrations, animations, and interactive content.
The "Run Script on Canvas" toggle allows you to render the html embed directly on the canvas, including executing JavaScript code. It will look exactly the same way as when you publish the site.
You can reuse your custom code across your project by putting it inside a Slot instance.
Add an HTML Embed component to your canvas and set it up with custom code of your choice.
Add a “Slot” component to your canvas and place your HTML Embed instance inside it.
Now, you can copy and paste this slot instance anywhere on your Webstudio project.
Please note that any updates you make inside your slot will update all other instances of that slot.
For more on Slots in Webstudio, refer to this guide.