Embedding Designs
Categories:
Meshery Design Embedding
Meshery Design Embedding enables you to export a design in a format that can be seamlessly integrated into websites, blogs, or platforms supporting HTML, CSS, and JavaScript. This embedded version provides an interactive representation of the design, making it easier to share with infrastructure stakeholders.
Embedding Your Design
To embed your Kanvas design, follow these steps:
Access Embed Option: Within the Kanvas Designer, select the design you wish to embed in the design drawer. Click on the export icon in the menu for the selected design. The export modal will appear, click on the “Embed” option.
Download the Embedding Script: Click on the download icon presented in the same modal to download the embedding script.
Embedding in Static Sites
The embed code for static site:
<div id="embedded-design-embedding-example"></div>
<script src="./embedded-design-embedding-example.js" type="module"></script>
Make sure the src
attribute in the script tag points to the location of the downloaded embedding script on your local filesystem or server.
Embedding in React Projects
- Install the Package: To integrate the Meshery Design into your React project, start by installing the package via npm:
npm i meshery-design-embed
- Incorporate the Component: Use the component to seamlessly embed designs within React and its associated frameworks.
import MesheryDesignEmbed from '@layer5/meshery-design-embed'
function Design() {
return (
<>
<div>
<MesheryDesignEmbed
embedScriptSrc="embedded-design-embed1.js" // path to the embed script
embedId="embedded-design-a3d3f26e-4366-44e6-b211-1ba4e1a3e644" // id of the embedding
/>
</div>
</>
);
}
Make sure the embedScriptSrc
attribute in the component points to the location of the downloaded embedding script on your react filesystem.
Usually the script is located “static” folder
Render
After Finishing the steps , the embedded design will be rendered like :
Customization
You can customize the styles for the embedded design by targeting CSS classes exposed or by adding inline styles. The following class can be overridden:
embed-design-container
: for the embedding containercy-container
: for the canvas
If you have multiple embeddings on a page, you can target them all using the classes or specific ones using the div’s ID in the shortcode.
Here is a customization example:
<style>
.embed-design-container {
width: 100%;
border-radius: 1rem;
margin: 1rem;
overflow: hidden;
margin-inline: auto;
height: 35rem;
}
.embed-canvas-container {
background-color: gray;
}
</style>
Recent Discussions on Kanvas
- Oct 14 | Explore Meshery's Published Relationship Design Examples by Awani Alero
- Oct 03 | Design Review RFC: Kanvas Empty State Enhancement by Lee Calcote
- Jul 19 | [For Discussion] Visual indication of semantically vs non-semantically meaningful Meshery components by Lee Calcote
- Jun 07 | What are the conditions for a "System is unhealthy" warning? by James
- May 30 | Looking for a meshmate to help with first PR by Faisal Imtiyaz123
- Feb 28 | For Discussion: Capturing potential, but unrealized Relationships in Design Snapshots by Lee Calcote
- Feb 12 | Hint on Scaling & Verifying Cronjob in Playground by Sandra Ashipala
- Sep 28 | Trying to add screenshots of Containerd & Curiefense integration by Raman Thakur