---
updatedAt: 2026-04-08T10:22:23.000Z
agentTools:
  projectIndex: https://developer.goacoustic.com/acoustic-content/llms.txt
---

# Create an Iframe component

[block:html]
{
  "html": "<div class=\"mktbox\">\n  <p class=\"image\"><svg margin-top=\" -6px\" width=\"43\" height=\"30\" viewBox=\"0 0 43 30\" fill=\"none\"><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M26,6V8.17L5.64,11.87a2,2,0,0,0-1.64,2v4.34a2,2,0,0,0,1.64,2L8,20.56V24a2,2,0,0,0,2,2h8a2,2,0,0,0,2-2V22.74l6,1.09V26h2V6ZM18,24H10V20.93l8,1.45ZM6,18.17V13.83L26,10.2V21.8Z\" fill=\"#000000\"></path></svg></p>\n  <h4 class=\"butitle\" >For marketers</h4>\n  <div class=\"Bulinks\">\n      <ul class=\"bulinklist\">\n      <li class=\"butopiclink\"><a href=\"https://help.goacoustic.com/hc/en-us/articles/360039832893-Create-articles-blogs-and-more\" target=\"_blank\" rel=\"noopener noreferrer\" data-ctaposition=\"1\">Create articles, blogs, and more </a></li>\n    <li class=\"butopiclink\"><a href=\"https://help.goacoustic.com/hc/en-us/articles/360039881513-Create-content-types\" target=\"_blank\" rel=\"noopener noreferrer\" data-ctaposition=\"1\">Create content types</a></li>\n    </ul>\n  </div>\n</div>\n\n<style>\n   .rdmd-html {\n    margin-bottom: 2em;\n    margin-left: 31px;\n    float: right;\n}\n  .image {\nfloat: left;\nwidth: max-content;\nmargin-bottom: -3px;\npadding-top:20px;\npadding-left:20px;\n  }\n .butitle {\n    padding-top: 5px;\n    margin-bottom: -5px;\n}\n\n  .butopiclink {\n    border-bottom: 1px solid #3d535b;\n    padding: .5rem 0;\n}\n  .mktbox{\n    background-color: #f3f3f4;\n    padding-top:10px;\n    padding-left: 5px;\n    padding-right: 20px;\n    padding-bottom: 20px;\n    z-index: 2;\n  position: relative;\n}\n  .magic-block-html ul:not(.browser-default) > li {\n    list-style-type: none !important;\n  }\n</style>"
}
[/block]

A configurable component can be added to a page just like any content. Adding the new components to your site is fast, simple, and easy. A script command added to the package.json file automatically generates the templates for your site. The following tutorial shows the instructions to create an Iframe component and add it to your site.

## Before you begin

To get started, you need:

* Your Acoustic Content trial or standard edition. Get a [free trial](https://acoustic.com/content-free-trial/) version or upgrade to the standard edition from [Acoustic Content](https://acoustic.com/products/content/).
* Install a [Node](https://docs.npmjs.com/getting-started/installing-node) environment with a recent stable version greater than  [Node >= 8](https://nodejs.org/en/?cm_mc_uid=63160199585115051461052\&cm_mc_sid_50200000=).
* Access to the site application code. To access the code download [Acoustic Content Sites single page application](https://github.com/acoustic-content-samples/wch-site-application). For more information about working with the source files, see [wch-site-application/README.md](https://github.com/acoustic-content-samples/wch-site-application/blob/master/README.md).
* For more information about setting up your development environment, see [Setting up your development environment](https://developer.goacoustic.com/acoustic-content/docs/setting-up-your-development-environment). For more information about developing sites with Content, see[Acoustic Content Sites Customization Programming Model](https://github.com/acoustic-content-samples/wch-site-application/blob/master/doc/README-programming-model.md).

## Create a content type

Create the Iframe content type in the Content UI and add it to your site. The Iframe content type has the following elements and settings:

* Name: Iframe
* Elements:
* source: link (required)
* width: number (required, a minimum value of 0)
* height: number (required, a minimum value of 0)

## Generate template files for the new component

After you create the content type, run the npm script in the SPA project to generate the template files for the new component:
`npm run create-layout -- --type Iframe`
The template file that is generated *src/app/components/iframe/abstractIframeComponent.ts* has the following three bounded elements:

[block:code]
{
  "codes": [
    {
      "code": " @RenderingContextBinding()  \n    readonly source: Link;\n    \n    @RenderingContextBinding()  \n    readonly width: number;\n    \n    @RenderingContextBinding()  \n    readonly height: number;\n    ",
      "language": "text",
      "name": ""
    }
  ]
}
[/block]

Use these variables to access the content type data.

## Create a layout

Define the layout by referencing the variables from the template in the *src/app/layouts/iframe/iframeLayout.html* file with the angular notation.
For example:

[block:code]
{
  "codes": [
    {
      "code": "<div [id]=\"(onRenderingContext | async).id\">  \n      \n            <iframe class=\"wch-iframe\" [src]=\"source.linkURL | formattedText:'resourceUrl'\" [width]=\"width\" [height]=\"height\">  \n      \n                   Sorry, your browser does not support inline frames.  \n      \n            </iframe>  \n      \n    </div>",
      "language": "text",
      "name": "Angular"
    }
  ]
}
[/block]

## Add styling to the component

Add style elements to the *src/app/layouts/iframe/iframeLayout.scss* file. For example:

[block:code]
{
  "codes": [
    {
      "code": ".wch-iframe {  \n      \n            resize: both;  \n      \n            max-width: 100%;  \n      \n    }",
      "language": "css"
    }
  ]
}
[/block]

## Publish the code changes to your site

* Run the following command to build your code.
  `npm run build`

* Run the following command to deploy your code.\
  `npm run deploy`

[block:callout]
{
  "type": "info",
  "title": "Note:",
  "body": "You must re-enter your Acoustic Content password for you to successfully run the commands."
}
[/block]

## Add the component to a page

The new component can now be added to a page in the Content UI. You must create a new content item from the new Iframe content type, complete the elements with data, and add that content item to a page of the site.

## Expected outcome

A set of active sample site components are provided to help you get started. The samples include a YouTube video integration, a charting sample with Chart.js, and an Iframe app. Download the sample components from [sample-active-site-components](https://github.com/acoustic-content-samples/sample-active-site-components) GitHub repository.