Search...

Iframe

Contrast Angular Bootstrap Iframe

Contrast Angular Bootstrap IFrame is a component used to embed another HTML document within the current HTML document.

The Contrast Angular Bootstrap IFrame, like every other Contrast Angular Bootstrap Components, is very responsive. The CDBIframe has callback props that enable us to fire functions at various events making it more interactive.

Importing the Contrast Angular Bootstrap Iframe Module

To use the Contrast Angular Bootstrap Iframe component in your project you need to import IframeModule.

ts
import {IframeModule } from 'cdbangular';

Default Iframe

Angular Bootstrap Iframe Default

HTML
html
<CDBIframe src="https://www.youtube.com/embed/xnczyP2jSR0"/>

API Reference: Contrast Angular Bootstrap Iframe Props

This section will build on your information about the props you get to use with the Contrast Angular Bootstrap Iframe component. You will find out what these props do, their default values, and how you would use them in your code.

The table below lists other prop options of the CDBIframe component.

NameTypeDefaultDescriptionExample
classStringAdds custom classesclass="myClass"
urlStringRequired. The iframe urlurl="https://www.youtube.com/embed/xnczyP2jSR0"
allowFullScreenBooleanfalseIf set, applies the allowFullScreen paramallowFullScreen=true
heightNumberDefines component heightheight=300
widthNumberDefines component widthwidth=300
idStringAdds id to the elementid="my_id"
nameStringAdds name attributename="myIframe"
onLoadfunctionFunction fired on onLoad eventonLoad={handleLoad}
onMouseOutfunctionFunction fired on onMouseOut eventonMouseOut={handleEvent}
onMouseOverfunctionFunction fired on onMouseOver eventonMouseOver={handleEvent}
ratioStringDefines component ratio. Choose from "1by1", "4by3", "16by9" and "21by9"ratio="1by1"
sandboxStringAdds optional sandbox values: (no value) - Applies all restrictions, allow-forms - Allows form submission, allow-modals Allows to open modal windows, allow-orientation-lock Allows to lock the screen orientation, allow-pointer-lock Allows to use the Pointer Lock API, allow-popups Allows popups, allow-popups-to-escape-sandbox Allows popups to open new windows without inheriting the sandboxing, allow-presentation Allows to start a presentation session, allow-same-origin Allows the iframe content to be treated as being from the same origin, allow-scripts Allows to run scripts, allow-top-navigation Allows the iframe content to navigate its top-level browsing context, allow-top-navigation-by-user-activation Allows the iframe content to navigate its top-level browsing context, but only if initiated by usersandbox=true
titleStringDefines component titletitle="my_title"
styleObjectAdd's additional styles.style={color: 'red'}

Build modern projects using Bootstrap 5 and Contrast

Trying to create components and pages for a web app or website from scratch while maintaining a modern User interface can be very tedious. This is why we created Contrast, to help drastically reduce the amount of time we spend doing that. so we can focus on building some other aspects of the project.

Contrast Bootstrap PRO consists of a Premium UI Kit Library featuring over 10000+ component variants. Which even comes bundled together with its own admin template comprising of 5 admin dashboards and 23+ additional admin and multipurpose pages for building almost any type of website or web app.
See a demo and learn more about Contrast Bootstrap Pro by clicking here.

ad-banner