The Embed component supports embedding videos from YouTube and Vimeo, providing a consistent and responsive way to display external media content within the design system. In addition to responsive behavior, the component includes JavaScript that automatically manages aspect ratios, sets video thumbnails as backgrounds, and adds play buttons for YouTube videos to enhance the user experience.
bt1d-embed
is-provider-youtube
HTML Example
<figure class="bt1d-embed is-provider-youtube">
<div class="bt1d-embed__wrapper">
<!--Embed Code Start-->
<iframe width="560" height="315" src="https://www.youtube.com/embed/Ibn1wXI0VT8?si=AS0ouUbM5viNwz1V" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
<!--Embed Code End-->
</div>
</figure>
bt1d-embed
is-provider-vimeo
HTML Example
<figure class="bt1d-embed is-provider-vimeo">
<div class="bt1d-embed__wrapper">
<!--Embed Code Start-->
<div style="padding:56.25% 0 0 0;position:relative;"><iframe src="https://player.vimeo.com/video/353385939?h=d0fd7f4488&badge=0&autopause=0&player_id=0&app_id=58479" frameborder="0" allow="autoplay; fullscreen; picture-in-picture; clipboard-write" style="position:absolute;top:0;left:0;width:100%;height:100%;" title="Back to School with T1D"></iframe></div><script src="https://player.vimeo.com/api/player.js"></script>
<!--Embed Code End-->
</div>
</figure>
To use the Embed component, copy the iframe embed code from the video platform (YouTube or Vimeo) and wrap it within the provided HTML structure. The JavaScript in the package ensures that the video displays properly, with the correct aspect ratio and additional features for YouTube videos.
bt1d-embed
: The main wrapper that contains the video embed.is-provider-youtube
: This class is applied when embedding a YouTube video.is-provider-vimeo
: This class is applied when embedding a Vimeo video.bt1d-embed__wrapper
: The inner wrapper that ensures the iframe scales properly and maintains the correct aspect ratio.The Embed Component includes JavaScript that enhances the functionality of embedded videos. The script ensures that each video has the correct aspect ratio and, in the case of YouTube videos, automatically adds a thumbnail as the background along with a custom play button.
Main JavaScript Features:
If you’re stuck or need assistance, don’t hesitate to reach out to our support team for guidance.