Skip to content

iFrame

A custom iFrame component with different configuration options.

Available in: App Page · Home Page · Record Page · Flow Screen

iframe

Read on Medium

How to Build a Reusable iFrame with Lightning Web Components

How to Build a Reusable iFrame with Lightning Web Components

Attributes

NameTypeDefaultDescription
heightstring'500px'Specifies the height of the iframe. Default height is 500 pixels.
sandboxstring''Enables an extra set of restrictions for the content in an iframe.
urlstring''Specifies the address of the document to embed in the iframe.
widthstring'100%'Specifies the width of an iframe. Default width is 100 percent.

Usage

html
<c-i-frame url="https://example.com/" height="600px" sandbox="allow-scripts allow-same-origin"></c-i-frame>

Note that the target site must allow itself to be embedded in an iframe (X-Frame-Options / frame-ancestors). All attributes are also configurable in the Lightning App Builder, so no code is required to use the component.

Released under the MIT License.