Installation
Install any component with the shadcn CLI, or copy the source straight from its docs page. Either way, the code ends up in your project.
Requirements
Some components are built on the html-in-canvas API, which ships in Chrome 157 and later. Each component page tells you if it applies. In browsers without support, components fall back automatically: your content renders as regular HTML and no errors are thrown.
Older versions of Chrome can turn the API on with the canvas-draw-element flag. Paste this into your address bar, enable the flag, and restart:
chrome://flags/#canvas-draw-elementTo cover visitors who haven't updated yet, register your domain for Chrome's origin trial, which runs through Chrome 160, and serve the token via a meta tag or HTTP header. Tokens are bound to a specific domain, so register your own. Chrome 157 and later need neither the flag nor a token.
Inside an html-in-canvas effect, the browser leaves out anything that could leak private data, such as cross-origin images and iframes that aren't CORS-enabled, visited-link styling, spelling markers, and system colors. Load images from your own origin, or from a CORS-enabled host with crossOrigin="anonymous".
Beyond that, TypeScript is recommended, since every file ships as typed source. React components target React 19, Solid components target Solid 1.9, Preact components target Preact 10, Vue components target Vue 3.5, and Svelte components target Svelte 5. Any dependencies a component needs are installed by the CLI and listed on its docs page.
Renderers: every effect has a WebGL build and a WebGPU build where available. WebGL is the default. WebGPU builds use vgpu, WGSL shaders, and the -webgpu registry suffix. Read the rendering guide.
On Android, native HTML capture stays disabled as a precaution after a Chrome renderer crash report, even in Chrome 157 or with the flag enabled. Content stays in the regular DOM; effects with an overlay fallback can still animate, while capture-only effects show plain HTML. This is a compatibility mitigation, not a confirmed fix for the underlying browser crash.
Install with the CLI
Every component has a registry entry per framework and per renderer: six WebGL entries and six WebGPU entries. Pick your package manager, renderer, and framework below, and the docs remember your choices everywhere.
npx shadcn@latest add @canvas-ui/liquid-reactThe renderer selector switches the command between the WebGL item and the WebGPU item. WebGPU registry names add -webgpu after the framework, for example @canvas-ui/liquid-react-webgpu.
The CLI drops the file into components/canvasui/ in your project (Svelte: src/lib/components/canvasui/, so the $lib import resolves). If you have not used shadcn before, run npx shadcn@latest init first.
Install manually
Prefer not to use a CLI? Open the component page, switch the code block to your framework and renderer, copy the file into your project, and import it.
Use it
Wrap the part of your interface the effect should run over. Props are optional and can be changed live.
import { Liquid } from "@/components/canvasui/Liquid";
export default function Page() {
return (
<Liquid rainbow style={{ height: 480 }}>
<YourContent />
</Liquid>
);
}For vanilla WebGPU, import from LiquidWebGPU.ts instead of LiquidVanilla.ts. The createLiquid call is the same.
Vanilla element setup
For html-in-canvas effects, source is the canvas that contains your HTML, content is the element inside that canvas to capture, and output is the separate canvas that displays the effect. Put id="content" on the inner element, not the outer container. You don't need to opt the canvas in yourself: the engine sets content="drawable" on source and drawable on content at runtime (or the older layoutsubtree before Chrome 155).
Vanilla callers must move the content into the regular DOM when html-in-canvas is unavailable or initialization returns null; framework wrappers handle this for you. See the complete HTML and TypeScript example.