Component set up in Figma
The components examples on this page are Figma components, embedded in this microsite page using the iframe method.
Component preperation in Figma
- Wrap an instance of a component in a frame
- Apply autolayout to the frame
- Apply the desktop width, or mobile width to the frame
- Appy height hug to the frame
- Add a prototype flow from the frame
- Name the frame: 'Component-name-desktop-embed' or 'Component-name-mobile-embed'
Generate iframe code in Figma
- Play the prototype flow created in #5 above
- Press share button, then choose 'Get embed code'
- Copy and replace the first part of the 'src' url, make sure to inclide the url and node ID:
https://embed.figma.com/proto/8wwg19mTSX6Y7S3qZ2wN2H/Croydon-Design-System-2024?node-id=5583-20070 - Copy and replace the starting-point-node-id towards the end of the url
- Copy and replace the page-id towards the end of the url
Use this iframe example as the starting point
For mobile components change the class on the div to 'embed-wrapper-mobile'
<div class="embed-wrapper-desktop">
<iframe class="iframe-embed" height="SET HEIGHT HERE"
src="https://embed.figma.com/REPLACETHIS?node-id=REPLACETHIS&viewport=REPLACETHIS&hide-ui=1&scaling=min-zoom&content-scaling=fixed&embed-host=share&starting-point-node-id=REPLACETHISID&page-id=REPLACETHIS"
allowfullscreen></iframe>
</div>
CSS in this page
Class applied to iframe to make it fill it's container:
.iframe-embed {
display: flex;
border: 2px solid rgba(0, 0, 0, 0.3);
width: 100%;
}
Class applied to div that wraps iframe, with max width for desktop:
div.embed-wrapper-desktop {
width: 100%;
height: auto;
max-width: 768px;
min-height: 200px;
}
Class applied to div that wraps iframe, with max width for mobile:
div.embed-wrapper-mobile {
width: 100%;
height: auto;
max-width: 370px;
min-height: 200px;
}
Page sections spacing fix
.paragraph--type--cds-design-system-text-section h2{
margin-top: 2rem;
}