Skip to content

Open WebUI Artifacts (2026): Live HTML, SVG and JavaScript Previews in Chat

7–10 minutes
Woman in a hijab in a living room holding a tablet with an OPEN WEBUI ARTIFACTS card, hook live preview in your chat

Open WebUI Artifacts turn code from the chat into a live preview right beside the conversation.

Ask a model for a landing page, an animated SVG logo, a D3 chart or a small JavaScript app, and Open WebUI renders it in a side panel where you can try it, ask for changes, flip between versions and download the result.

It is Open WebUI’s take on the Artifacts idea popularised by Claude.ai, and it works with any model you connect, including local models through Ollama.

This guide covers what Artifacts can render, how to open them, editing and versions, prompts that reliably trigger a preview, the iframe sandbox settings, locking previews down with IFRAME_CSP, which local models work best and fixes for blank or broken previews. It follows the official Open WebUI documentation as of December 2026.

TL;DR

  • Renders: single-page HTML, SVG, full pages with HTML+CSS+JS, and ThreeJS or D3.js visualizations.
  • Not rendered: Markdown, plain text, ordinary code snippets and React components.
  • Open: the + menu in the chat tab bar > Artifacts; auto-detect is on by default.
  • Versions: every edit makes a new version; switch with the selector at top left.
  • Safety: previews run in a sandboxed iframe; keep Allow Same Origin off.
  • Lock down: set IFRAME_CSP to block network calls from previews.

What Artifacts Can Render

Open WebUI creates an Artifact when the model’s reply contains content it can render:

Content Rendered as Artifact? Notes
Single-page HTML site Yes Most common use
SVG image Yes Preview has pan and zoom
Full page with HTML, CSS and JavaScript Yes HTML is required for a full page
ThreeJS, D3.js and similar visualizations Yes Libraries load inside the HTML
Markdown or plain text documents No Shown in the chat
Ordinary code snippets No Use Code Interpreter to run code
React components No Ask for plain HTML/JS instead

The model has to produce valid HTML or SVG. When it does, Open WebUI detects it and shows the interactive preview. Need Open WebUI first? Follow our Open WebUI with Ollama setup guide.

How to Open and Use Artifacts

  1. Start a chat with a capable model and ask for something renderable, for example “Create a single-page HTML pomodoro timer with CSS and JavaScript in one file”.
  2. When the reply contains renderable code, the Artifacts panel opens automatically. This is controlled by Settings > Interface > Artifacts > Detect Artifacts Automatically, which is on by default.
  3. If the panel is closed, open it from the + menu in the chat’s tab bar and choose Artifacts. The entry only appears when the chat contains a renderable artifact.
  4. Interact with the preview: click buttons, test forms, watch animations.
  5. Use the toolbar above the preview to copy or download the selected version.
  6. For HTML, choose Open in full screen at the right end of the toolbar to test it at full size.

Tool output shown as a Rich UI embed has its own viewer and does not use the Artifacts toolbar.

Prompts That Trigger an Artifact

Most failures come from the model returning React, several separate files or a code fragment. Be explicit:

  • “Return one complete HTML file with inline CSS and JavaScript, no external build step.”
  • “Create an SVG logo for a coffee shop called Bean There, 512×512, flat style.”
  • “Build a D3.js bar chart in a single HTML page using this data: Jan 120, Feb 150, Mar 90. Load D3 from a CDN script tag.”
  • “Make a ThreeJS rotating cube with orbit controls in one HTML file.”
  • “Turn this table into an interactive HTML page with sorting and a search box.”

You can save prompts like these as slash commands with our Open WebUI prompts guide, or bake “always return single-file HTML” into a custom model with our Open WebUI custom models guide.

Editing and Versions

Ask for changes in the same chat and the Artifact updates. Every edit creates a new version, and the version selector at the top left lets you jump between them.

Targeted updates

  • “Change the colour of the bars from blue to red.”
  • “Update the SVG title to ‘New Title’.”

Full rewrites

  • “Rewrite this single-page site as a product landing page.”
  • “Redesign this SVG so it is animated with ThreeJS.”

Best practices from the docs: say exactly which part to change, quote unique text near the change, and decide whether a small update or a full rewrite fits better. Compare versions before downloading the final one.

Preview Sandbox Settings

Previews render inside a sandboxed srcdoc iframe. Four settings under Settings > Interface control what generated HTML may do:

Setting Default What it allows
iframe Sandbox Allow Scripts On JavaScript runs in the preview; most artifacts need it
iframe Sandbox Allow Forms On Forms in the preview can be submitted
iframe Sandbox Allow Downloads On The preview can start a file download
iframe Sandbox Allow Same Origin Off The preview shares your Open WebUI origin

Leave Allow Same Origin off unless you hit the specific error in Troubleshooting. With it on, script in a preview is same-origin with Open WebUI and can reach your session. To view something you do not trust, turn the other three off so it renders but stays inert.

Secure Previews With IFRAME_CSP

For tighter control, set the IFRAME_CSP environment variable. It is empty by default and applies to every srcdoc iframe: Artifacts, code and HTML previews, file previews, citation modals, MCP Apps and Visualizations.

This example keeps inline scripts and styles working but blocks fetch, XHR and WebSockets, so an artifact cannot quietly call out to the network:

IFRAME_CSP=default-src 'self' 'unsafe-inline' 'unsafe-eval' data: blob:; connect-src 'none'

In Docker, add it with -e:

docker run -d -p 3000:8080 -v open-webui:/app/backend/data \
  -e IFRAME_CSP="default-src 'self' 'unsafe-inline' 'unsafe-eval' data: blob:; connect-src 'none'" \
  --name open-webui ghcr.io/open-webui/open-webui:main

IFRAME_CSP is a startup variable, not an Admin Panel setting, so restart after changing it. Start permissive and tighten, because a strict policy can make previews blank.

Note: a CSP like the one above also blocks CDN libraries loaded over the network if you add a restrictive script-src, so test your common artifacts after each change.

Best Models for Artifacts

Artifacts depend on the model writing complete, valid HTML in one go. Large hosted models do this reliably. Locally, prefer strong coding models with long context, because a single-file app can easily be several thousand tokens. Small models often stop mid-file or wrap the code in explanations, which breaks the preview.

  • Raise the context length if replies cut off; see our Ollama context length guide.
  • Ask the model to “output only the HTML file” to reduce chatter.
  • If a file is long, ask it to continue, then request “the full final file” so the Artifact has one complete version.

Project Ideas

  • Interactive charts: a D3 line chart of prices, then a second version with a different colour scale to compare.
  • Single-page tools: a to-do list, unit converter, tip calculator or markdown previewer in HTML and JS.
  • Animated SVGs: a brand logo or loading spinner for a site or social post.
  • Landing page prototypes: test layout and copy before building the real site.
  • Interactive stories: scrolling timelines and animations for presentations.

Artifacts vs Code Interpreter

Artifacts Code Interpreter
Runs HTML, SVG and browser JavaScript in a preview Python code
Where Sandboxed iframe in your browser Pyodide in the browser or a Jupyter backend
Best for Visual pages, prototypes, charts Data analysis, calculations, files

For Python, see our Open WebUI Code Interpreter guide. For a full shell and file system, see our Open Terminal guide.

Troubleshooting

Preview does not appear: “Uncaught SecurityError”

If the console shows Artifacts.svelte:40 Uncaught SecurityError, cross-origin iframe restrictions are blocking it. Go to Settings > Interface, turn on iframe Sandbox Allow Same Origin and save. Only do this if you need it.

Preview is blank after setting IFRAME_CSP

Open browser dev tools, find the CSP violation, and relax the policy only for that resource. To rule it out, unset IFRAME_CSP and restart.

No Artifacts entry in the + menu

The chat has no renderable content yet, or the model returned React or a code fragment. Ask for one complete HTML file.

Panel does not open automatically

Check Settings > Interface > Artifacts > Detect Artifacts Automatically.

Buttons do nothing

iframe Sandbox Allow Scripts may be off. Turn it back on for trusted content.

The code is cut off

The model hit its output or context limit. Increase context, use a stronger model or ask for a shorter version.

FAQ

Are Open WebUI Artifacts the same as Claude Artifacts?

They are inspired by Claude.ai’s feature but work with any model in Open WebUI, including local ones.

Can Artifacts render React?

No. Ask for plain HTML, CSS and JavaScript in one file instead.

Do Artifacts work offline with Ollama?

Yes, as long as the HTML does not load libraries from the internet. Ask for no external dependencies if you are offline.

Can I download an Artifact?

Yes. Use the copy or download buttons in the toolbar above the preview.

Is it safe to run generated HTML?

Previews are sandboxed. Keep Allow Same Origin off and use IFRAME_CSP for extra protection.

Can I turn Artifacts off?

Turn off Detect Artifacts Automatically to stop the panel opening; admins can also hide controls for users through permissions, see our users and groups guide.

Sources

Free weekly email

Get new AI guides every week

One short weekly email with our newest local AI, ComfyUI and AI tool guides. No spam, no pop-ups, just the good stuff.

Free. Unsubscribe anytime in one click. We only use your email to send this newsletter. See our privacy policy.

Woman in a hijab in a living room holding a tablet with an OPEN WEBUI ARTIFACTS card, hook live preview in your chat