Iframe
A cool and fancy Iframe that can make your life easier and also looks good.
import { Iframe } from "@schukai/monster/source/components/layout/iframe.mjs";Introduction
The monster-iframe component wraps an iframe with Monster layout styling and sizing behavior. It is useful for embedding internal pages or tools while keeping a consistent layout shell.
Configuration
Provide the target URL through the src option. You can also set standard iframe attributes such as sandbox, loading, and referrerPolicy via options.
Responsive Behavior
The component observes its own size and adjusts the iframe height to fit the available space. This makes it suitable for split panels or resizable containers.
Simple Iframe
A basic iframe embedding an internal documentation page. The component adjusts its height to the available space and supports standard iframe options.
Javascript
import '@schukai/monster/source/components/layout/iframe.mjs';
const iframe = document.createElement('monster-iframe');
iframe.setOption('src', '/foundations.typography.html');
iframe.setOption('loading', 'lazy');
document.body.appendChild(iframe);HTML
<div id="iframe-simple"></div>Stylesheet
/** no additional stylesheet is defined **/Component Design
The iframe is rendered inside a Shadow DOM wrapper for consistent styling. The exported part allows customization of the outer container.
Exported Parts
control: Wrapper around the iframe element.
monster-iframe::part(control) {
border: 1px solid #e2e8f0;
border-radius: 12px;
overflow: hidden;
}
HTML Structure
<monster-iframe></monster-iframe>JavaScript Initialization
const element = document.createElement('monster-iframe');
document.body.appendChild(element);Exported
IframeDerived from
CustomElementOptions
The Options listed in this section are defined directly within the class. This class is derived from several parent classes, including the CustomElement class. Therefore, it inherits Options from these parent classes. If you cannot find a specific Options in this list, we recommend consulting the documentation of the CustomElement.
- since
- deprecated
Properties and Attributes
The Properties and Attributes listed in this section are defined directly within the class. This class is derived from several parent classes, including the CustomElement class and ultimately from HTMLElement. Therefore, it inherits Properties and Attributes from these parent classes. If you cannot find a specific Properties and Attributes in this list, we recommend consulting the documentation of the CustomElement.
data-monster-options: Sets the configuration options for the collapse component when used as an HTML attribute.data-monster-option-[name]: Sets the value of the configuration option[name]for the collapse component when used as an HTML attribute.
Methods
The methods listed in this section are defined directly within the class. This class is derived from several parent classes, including the CustomElement class and ultimately from HTMLElement. Therefore, it inherits methods from these parent classes. If you cannot find a specific method in this list, we recommend consulting the documentation of the CustomElement.
Static methods
[instanceSymbol]()- {symbol}
instanceof operator.getCSSStyleSheet()- {CSSStyleSheet[]}
getTag()- {string}
Lifecycle methods
Lifecycle methods are called by the environment and are usually not intended to be called directly.
[assembleMethodSymbol]()- {Components.Layout.Iframe
monster-iframe-clicked
connectedCallback()- {void}
disconnectedCallback()- {void}
Events
The component emits the following events:
monster-iframe-clicked
For more information on how to handle events, see the mdn documentation.