# Chrome HTML-in-Canvas: where to use it, with demos

HTML-in-Canvas is stable in Chrome 157. Little code, mostly where to use it, with public demos and a video in the post and a look at how the studio hero uses it.

- Language: en
- Published: 2026-11-07
- Tags: dev, design, chrome, canvas
- URL: https://devs7ud.io/en/deep-dives/html-in-canvas-chrome-157-en
- Translation (ko): https://devs7ud.io/deep-dives/html-in-canvas-chrome-157.md

## Real HTML now moves inside a canvas

HTML-in-Canvas is a stable feature in Chrome 157. The Chrome developer blog announced the stable release on October 26. In one line, it lets you draw real HTML (inputs, buttons, text) inside a `<canvas>`. After it is drawn, the element can still be clicked, still takes typing and stays in the accessibility tree.

Until now, putting UI in a canvas meant drawing the inputs and text by hand, or turning HTML into one flat image. A flat UI did not respond to clicks and screen readers could not read it. This feature fixes both.

You only need this much of the technique.

```html
<canvas id="c" content="drawable">
  <form id="card" drawable> ... </form>
</canvas>
```

```js
ctx.drawElementImage(card, x, y); // draw the element on the canvas
```

Put `content="drawable"` on the canvas and `drawable` on the element, then draw it with `drawElementImage()`. In 2D the element's position and pixels stay in sync on their own. In WebGL and WebGPU you tell the browser the position yourself with `updateElementGeometry()`. The rest is in the demos and the tips below.

## Screens before words

An overview video introduced in Chrome's official post. Nothing connects to YouTube until you press play.

[Video: HTML-in-canvas: Where interactive content and high performance graphics meet](https://www.youtube.com/watch?v=mB0eWkWubuk)

The community demos come from the [list the Chrome team keeps](https://github.com/GoogleChromeLabs/css-web-ui-demos/blob/main/html-in-canvas/awesome-html-in-canvas.md). The four screens below were captured by opening them in Chrome 156 with the feature flag on.

![The Liquid DOM demo, with HTML text on a glass-like notification card](/blog-img/html-in-canvas-chrome-157/1.jpg "Liquid DOM")

![A jelly-shaped slider demo that squishes when pressed](/blog-img/html-in-canvas-chrome-157/2.jpg "Jelly slider")

![A PixiJS demo with HTML text and buttons over a pixel-art castle](/blog-img/html-in-canvas-chrome-157/3.jpg "PixiJS")

![An HTML in Canvas demo with a list of examples on a blue background](/blog-img/html-in-canvas-chrome-157/4.jpg "HTML in Canvas Demo")

_Images: [Liquid DOM](https://liquid-dom-showcase.vercel.app/) (Andrew Prifer), [Jelly slider](https://wicg.github.io/html-in-canvas/Examples/webgpu-jelly-slider/) (WICG example), [PixiJS HTML Laser](https://pixijs-html-in-canvas.vercel.app) (Zyie), [HTML in Canvas Demo](https://html-in-canvas.vittoretrivi.dev/) (Vittorio Retrivi). Screens captured on November 7, 2026._

More demos you can open yourself. The ones with motion need Chrome 157 or later.

- [Compiz Web](https://compiz-web.vercel.app/) — Shader transitions between web pages \(Max Leiter\)
- [Curved Markup](https://random-stuff.jakearchibald.com/apps/curved-markup/) — Selectable text on a curved screen \(Jake Archibald\)
- [HTML cloth](https://arrival.space/htmlcanvas) — Form fields on a hanging cloth in a game \(Thomas Richter-Trummer\)
- [Duck Hunt TODO](https://x.com/wesbos/status/2041594973674483851) — A form turned into a shooting target \(Wes Bos\)
- [Wobble Buttons](https://x.com/wesbos/status/2041974552478052507) — Buttons that wobble when pressed \(Wes Bos\)
- [Quest Signal](https://vav-labs.com/case-studies/quest-signal/) — DOM panels as 3D textures in a Godot scene \(Vav Labs\)

## Where it fits in practice

The official post and the demos group the uses into six. If you already use a canvas or 3D, these are the first candidates.

**Six places to use it**

| Where | How | Demo |
| --- | --- | --- |
| Shader effects on UI | Draw the real UI, then add glass, ripples or transitions | Liquid DOM, Compiz Web, Jelly slider |
| Menus inside 3D and games | Keep a terminal, a book or a form in a 3D scene as real DOM | HTML cloth, Quest Signal |
| Chart labels | Lay out multi-line labels and legends in HTML and put them on the chart | WICG pie chart |
| Image and video export | Export HTML-styled text with shader effects as an image or video stream | The media editing case in the official post |
| Text on shapes | Keep text selectable and readable on a curved or warped surface | Curved Markup |
| Accessible canvas apps | Keep a canvas app's buttons and inputs as DOM instead of rebuilding them | The large canvas app case in the official post |

_Sources: the Chrome blog, the WICG repository and the Chrome team's list of community demos._

Three.js (`THREE.HTMLTexture`, experimental), PlayCanvas, PixiJS (built in since v8.19.0) and Babylon.js have added support, and CanvasUI is an open-source component set. Google does not maintain these libraries.

## What to know before you use it

**1. Detect it and keep a fallback.** Support today means Chrome 157 or later. The detection in the official docs sets `content="drawable"` on a canvas and checks that the value reads back. When it is missing, the docs suggest an alternative UI, floating HTML or a library such as html2canvas.

**2. Without support, what is inside the canvas does not show.** This is something we checked ourselves. Elements placed inside a canvas are not displayed in a browser without the feature. We had to write a separate path that shows the same card outside the canvas.

**3. Ask for a repaint every frame to animate.** When the DOM changes, the canvas fires a `paint` event. For animation without DOM changes, call `requestPaint()` each frame. DOM changes made inside `paint` appear in the next frame.

**4. Keep size and position in step.** Size the canvas to the screen's real pixels (with a `ResizeObserver`) and change its size only when needed, because that clears the canvas. In WebGL and WebGPU, report an element's position every time it moves, or taps land where it used to be.

**5. Hide it when decorative, keep it when it is a control.** Drawn content stays in the accessibility tree like normal DOM. If it is decoration, hide it with `aria-hidden` and `inert`. If people must operate it, leave it as it is.

**6. Trust what the browser protects, and know the limits.** According to the WICG explainer, things that could leak, such as visited links, cross-origin content and spelling markers, are not drawn. The official post also says browser extensions can act on the drawn content, for example by changing text.

## We used it in the studio hero

The hero on our company page draws the logo like a scribble and then introduces dsui components one by one on a canvas. Until now the cards for the button, switch, slider and others were drawn one canvas command at a time. So when a component's look changed, the hero's picture had to be fixed separately.

Now, in browsers that support the feature, six cards (Button, Switch, Slider, Tabs, Input and Chip) are drawn as real components. Without support, the old hand-drawn cards are used. The detection and the drawing live in one file, and if a draw is not possible, only that frame falls back to the hand-drawn card.

```ts
// apps/studio/lib/home/html-in-canvas.ts
export function drawElementCentered(context, element): boolean {
  const draw = context.drawElementImage;
  if (!draw || !element.offsetWidth) return false;
  try { draw.call(context, element, -element.offsetWidth / 2, -element.offsetHeight / 2); return true; }
  catch { return false; }
}
```

![The hero card with a real Slider component drawn on it, pointing at a volume of 64](/blog-img/html-in-canvas-chrome-157/5.png "Supported browser: a real Slider")

![A hand-drawn Switch card in the same place](/blog-img/html-in-canvas-chrome-157/6.png "Unsupported browser: a hand-drawn Switch")

_Images: the hero on the devs7ud.io company page. Left: Chrome 156 with the feature on. Right: Chrome 156 with it off._

Some things are still unchecked. We have not opened it in the stable Chrome 157 or on mobile, and we have not captured how the Tabs, Input and Chip cards look. The components inside the canvas are decoration, so they cannot be pressed.

## View

HTML-in-Canvas fits first in screens that already use a canvas: games, 3D scenes, shader effects and editors, where you need real inputs and text that still move on top of an image. Bringing in a canvas only to add effects to ordinary web cards and buttons is still early.

The official post does not say how other browsers stand, so if you use it now, write the fallback first. Core features should work the same without it, and this should be a layer on top. Starting with decoration that the screen can do without, as in our hero, keeps the risk small.

## This post's limits

The explanation follows the Chrome official blog and docs and the WICG explainer. We opened the demos in Chrome 156 with the feature flag on, and two that need motion (Compiz Web and Curved Markup) showed no picture in this setup, so they are not pictured. For Wes Bos's posts on X and the Quest Signal case, we only carried over what the Chrome team's list says and did not open them. We could not confirm other browsers' support because the official post does not state it.

## Sources

- [HTML-in-Canvas in Chrome 157](https://developer.chrome.com/blog/html-in-canvas) (Chrome for Developers, October 26, 2026)
- [HTML-in-Canvas docs and concepts](https://developer.chrome.com/docs/web-platform/html-in-canvas/concepts)
- [WICG html-in-canvas explainer and examples](https://github.com/WICG/html-in-canvas)
- [Community demo list](https://github.com/GoogleChromeLabs/css-web-ui-demos/blob/main/html-in-canvas/awesome-html-in-canvas.md)
