Skip to main content
iVentureTeam

iframe

The iframe widget renders a field as an embedded preview frame for the website theme picker, and flips to a mobile viewport when the theme screen tells it to.

September 18, 2026Updated September 18, 20263 min read
Technical nameiframe
Field typesany (undeclared)
Viewsform
Modulewebsite, only present when the Website app is installed
Used in core1 use in Odoo 19 Community. Unchanged in Odoo 20.
VersionsOdoo 19.0, Odoo 20.0
No-code setupNo. There is no Studio entry for this widget.
Alternativeshtml, image, url

What the iframe widget does

The component is small enough to quote almost entirely:

class FieldIframePreview extends Component {
    static template = "website.iframeWidget";
    static props = { ...standardFieldProps };
    setup() {
        this.state = useState({ isMobile: false });

        useBus(this.env.bus, "THEME_PREVIEW:SWITCH_MODE", (ev) => {
            this.state.isMobile = ev.detail.mode === "mobile";
        });
    }
}

It renders the website.iframeWidget template and keeps one piece of state, whether to show a mobile viewport. That state is driven entirely by an event on the environment bus.

The descriptor is one line: { component: FieldIframePreview }. No display name, no supported types, no options.

What this means for your team

This is the frame you look at when picking a website theme, and the desktop and mobile toggle above it is what this widget is listening to.

It is not a general-purpose embed. If someone on your team wants to show a partner portal, a dashboard from another system or a document preview inside an Odoo form, this widget is not the tool, and reaching for it will produce a frame with no way to toggle and no configuration.

Working examples

The standard use, on the theme picker:

<field name="theme_preview_url" widget="iframe"/>

Applying it elsewhere renders the frame, but the mobile toggle will never fire because nothing outside the theme screen emits the event it waits for.

Why the mobile toggle only works on one screen

The widget does not own its own toggle. It subscribes to an event on the shared environment bus:

useBus(this.env.bus, "THEME_PREVIEW:SWITCH_MODE", (ev) => {
    this.state.isMobile = ev.detail.mode === "mobile";
});

Something else has to fire THEME_PREVIEW:SWITCH_MODE with a mode in its detail. In standard Odoo that something is the theme preview screen's own controls.

Put this widget on an ordinary form and it renders, but isMobile stays false forever, because nothing on that form emits the event. Nothing errors and nothing warns. The frame simply never switches, which reads as a broken toggle rather than an absent one.

If you do want that behavior on your own screen, the fix is not to change the widget. Emit the same event on the environment bus from your own component and this widget will respond, because the bus is shared rather than scoped to the theme screen.

Version compatibility

VersionStatusNotes
Odoo 19.0VerifiedVerified against the shipped 19.0 source.
Odoo 20.0VerifiedVerified against the 20.0 branch. No changes.

Unchanged between the two branches we checked, including its single usage.

What is changing in Odoo 20

No change. Diffing the registration between the 19.0 and 20.0 branches shows the same single-key descriptor, still with no options and no supported types.

Common problems and fixes

SymptomCause and fix
The mobile toggle does nothingNothing on this screen emits THEME_PREVIEW:SWITCH_MODE on the environment bus. Emit that event yourself from your own component, or accept the desktop frame.
The widget is not availableIt ships in the website module. Install Website, or build your own embed component.
The frame is the wrong sizeSizing lives in the website.iframeWidget template, not in any option. Inherit the template, or write a component of your own.

Iframe widget vs the alternatives

WidgetBest forKey difference
iframeThe website theme preview frameNo options, and its mobile toggle depends on an event only the theme screen fires
htmlRich content stored on the recordEditable content rather than an embedded frame
imageA stored imageRenders an image, with no frame or viewport switching
urlA link out to an external pageOpens in a new tab instead of embedding

For embedding something that is genuinely a document or an image, use the widget built for that content type rather than a frame. For an external page inside an Odoo screen, an OWL component of your own is usually the honest answer, because you will want control over sizing, sandboxing and error states that this widget does not expose.

Frequently asked questions

What is the Odoo iframe widget for?+
It renders the embedded preview frame on the website theme picker. It listens on the environment bus for THEME_PREVIEW:SWITCH_MODE and switches to a mobile viewport when that event fires.
Can I use the iframe widget to embed any external page?+
It will render, but it has no options for sizing, sandboxing or error handling, and its mobile toggle stays inert because nothing outside the theme screen emits the event it listens for. A custom component is usually the better answer.
Does the iframe widget have options?+
No. Its descriptor has a single key, the component. There is no display name and no supported types, and everything about the frame lives in the website.iframeWidget template.

Want another system's screen inside Odoo?

Embedding a portal, a BI dashboard or a partner tool into an Odoo form is usually less about the frame and more about auth, sizing and what happens when the other side is down. We build those embeds so they degrade gracefully.

Book a free consultation

How this page was produced

Verified by reading addons/website/static/src/components/fields/widget_iframe.js on the 19.0 branch of a local clone of the official Odoo repository. The component and its bus subscription are quoted in full above. The registration was diffed against the 20.0 branch. The usage count comes from scanning every XML file in Community, Enterprise and odoo/addons/base. Corrections welcome via our contact page.