DavidHDev/canvas-ui

A library of creative canvas components. Real HTML with WebGL effects running over it. React, Vue, Svelte, vanilla.

TypeScript

4,795

175 commits

updated Oct 3, 2026

See the code

README

Canvas UI

An open source library of creative, framework-agnostic components drawn on canvas.
Fluid simulations, shader effects, and 3D scenes that run over your live, fully interactive interface. WebGL or WebGPU via vgpu, your choice.

canvasui.dev · Docs · Components · Playground · Installation · Rendering

GitHub stars CI status 35 components License: MIT + Commons Clause

React Vue Svelte Solid Preact TypeScript

What makes it different

Most components use the experimental HTML-in-canvas API to read and redraw your live DOM. Text stays selectable, links stay clickable, and the page becomes a texture that fire, fluid, and glass distort in real time.

Where it is not supported, components fall back to GPU overlays, so every visitor gets a working page.

🎨35 components and counting: Liquid, Glass, Shatter, Force Field, Decrypt Reveal, and more
🧩Framework agnostic: every component ships for React, Solid, Preact, Vue, Svelte, and vanilla, in both WebGL and WebGPU builds
🖥️Two renderers: WebGL with GLSL, or WebGPU through vgpu with WGSL
📋Copy, do not install: source lands in your repo via a shadcn-compatible registry
⚡Zero config: self-contained, with sensible defaults and typed props
🤖MCP ready: let your AI assistant find and install components for you

Quick start

Add a component with the shadcn CLI (run npx shadcn@latest init first if you have not):

npx shadcn@latest add @canvas-ui/liquid-react

Swap liquid for any component, react for solid, preact, vue, svelte, or vanilla. Source lands in components/canvasui/, yours to edit.

import { Liquid } from "@/components/canvasui/Liquid";

export default function Page() {
  return (
    <Liquid>
      <YourEntirePage />
    </Liquid>
  );
}

Most components wrap your content. The subtree stays live and interactive; the effect runs on top.

See the installation guide for manual setup.

WebGL and WebGPU

Every effect ships in two renderer builds. The WebGL build is the default: raw WebGL2 and GLSL, zero dependencies except three for the object effects. The WebGPU build renders through vgpu with WGSL shaders, keeps the same props and public API, and installs with the -webgpu registry suffix:

npx shadcn@latest add @canvas-ui/liquid-react-webgpu

WebGPU builds ship for all six frameworks. They need a browser with WebGPU, Chrome/Edge 113+, Safari 26+ / iOS 26, or Firefox 141+. If WebGPU is missing, the wrapped content renders unchanged. Details in the rendering guide.

Components

Every component ships for all six frameworks in both renderer builds. Compare them in the playground.

🌊 Fluid & motion
ComponentWhat it doesComponentWhat it does
LiquidPointer-driven fluid simulationRippleWater ripples from every click
ClothFabric rippling in the windDropletsRain running down the screen
BubbleMetaball droplet trailing the cursorDisplacementGrid that ripples away from the cursor
🔥 Fire & energy
ComponentWhat it doesComponentWhat it does
BlazeSparks, smoke, and heat distortionFlame WrapBorder of fire around any element
Force FieldEnergy shield with click shockwavesLaserBeam that reveals content on scroll
💎 Glass & optics
ComponentWhat it doesComponentWhat it does
GlassCrystal-ball lens that follows the cursorFrostIce that melts under the cursor and refreezes
MagnifySci-fi scanner lens with a HUD reticleBendFolds the page like the face of a cube
PeelPeels back to reveal a second layerCloudsMist parted by cursor wind
📼 Retro & glitch
ComponentWhat it doesComponentWhat it does
VHSWorn tape wave, chroma bleed, and grainGlitchBroadcast tearing with RGB splits
Retro DitherDither lens that pixelates the pageAsciifyASCII lens that follows the cursor
Decrypt RevealCipher text decrypting at the cursorGlyph RainFalling glyphs that light up the page
✨ Particles & structure
ComponentWhat it doesComponentWhat it does
Particle RevealParticles merging into crisp UIParticle ScrollSand that reassembles on scroll
Shatter3D glass shards that lift and refractGrid3D tiles rippling around the cursor
Hex FloatFloating hex tiles with cursor liftCanvasWoven canvas you drag wet paint across
🧊 3D effects: no flag needed, these work everywhere

Point these at a GLB/glTF model, SVG, or image to render it as a 3D scene.

ComponentWhat it doesComponentWhat it does
ASCII ObjectRedrawn as shape-matched ASCIIGlass ObjectLiquid glass with real dispersion
Particle ObjectParticles that scatter and spring backDithered ObjectRendered through a 1-bit dither
Liquid ObjectDragged through swirling liquid

Browser support

BrowserHTML-in-canvas components3D effect components
Chrome with the flag or origin trial✅ Full effect✅ Full effect
Everything else⚠️ GPU overlay fallback✅ Full effect

Html-in-canvas needs Chrome with the chrome://flags/#canvas-draw-element flag. An origin trial token lifts that for your visitors. That is how canvasui.dev runs in a plain Chrome install. Details in the docs.

Chrome 150's changes to texElementImage2D() and copyElementImageToTexture() do not require a migration in Canvas UI. The HTML effects capture content with the 2D drawElementImage() API, then upload the canvas with standard texImage2D() (WebGL) or copyExternalImageToTexture() (WebGPU). Those upload methods keep their existing signatures. This also applies to the generated registry components for all six frameworks.

The later HTML-in-Canvas changes also affect capture markup and hit testing. Canvas UI synchronizes the captured element's geometry when the browser requires it, keeping scrolling, clicks, and cursor effects working in Chrome 154. It also selects content="drawable" and drawable when the newer API is available, while preserving support for layoutsubtree and automatic 2D geometry synchronization.

Both renderers follow pinch zoom through visualViewport, increasing capture and rendering resolution while preserving the HTML's position and interactions. The normal 2× device-pixel-ratio budget is multiplied by the zoom scale, subject to GPU limits, an 8192-pixel maximum dimension, and a 16-megapixel buffer budget. Particle Scroll uses plain HTML without a GPU overlay when HTML-in-Canvas is unavailable, including in Safari.

Use with AI

The registry is MCP ready, so your assistant can browse and install components:

npx shadcn@latest mcp init --client claude

Works with Claude Code, Cursor, VS Code, Codex, and OpenCode. Then just ask: "add the Liquid component from Canvas UI".

Development

This repo holds the library source, the docs site (Next.js 16, Tailwind v4, on Cloudflare Workers), and the registry build.

npm install
npm run dev        # builds the registry, then starts next dev
npm run build      # production build
npm run deploy     # build and deploy to Cloudflare
PathWhat lives here
src/lib/<Component>/WebGL and WebGPU engines plus framework wrappers
src/demos/Interactive demo and controls for each component
src/app/Documentation site routes
scripts/build-registry.mtsGenerates public/r/*.json for the shadcn CLI

Each component is plain TypeScript with thin framework wrappers. WebGL builds use raw WebGL2 and GLSL. WebGPU builds use vgpu and WGSL. Nothing depends on another Canvas UI component, and each engine defines its own props.

Contributing

Issues and pull requests welcome. See CONTRIBUTING.md.

License

MIT + Commons Clause. Free in your own projects, commercial or not. The Commons Clause only restricts selling the library itself.

animation
canvas
component-library
components
creative-coding
design-engineering
frontend
glsl
nextjs
react
shadcn
shaders
svelte
threejs
typescript
ui
ui-library
vue
weggl

DavidHDev/canvas-ui

A library of creative canvas components. Real HTML with WebGL effects running over it. React, Vue, Svelte, vanilla.

TypeScript

4,795

175 commits

updated Oct 3, 2026

See the code

README

Canvas UI

An open source library of creative, framework-agnostic components drawn on canvas.
Fluid simulations, shader effects, and 3D scenes that run over your live, fully interactive interface. WebGL or WebGPU via vgpu, your choice.

canvasui.dev · Docs · Components · Playground · Installation · Rendering

GitHub stars CI status 35 components License: MIT + Commons Clause

React Vue Svelte Solid Preact TypeScript

What makes it different

Most components use the experimental HTML-in-canvas API to read and redraw your live DOM. Text stays selectable, links stay clickable, and the page becomes a texture that fire, fluid, and glass distort in real time.

Where it is not supported, components fall back to GPU overlays, so every visitor gets a working page.

🎨35 components and counting: Liquid, Glass, Shatter, Force Field, Decrypt Reveal, and more
🧩Framework agnostic: every component ships for React, Solid, Preact, Vue, Svelte, and vanilla, in both WebGL and WebGPU builds
🖥️Two renderers: WebGL with GLSL, or WebGPU through vgpu with WGSL
📋Copy, do not install: source lands in your repo via a shadcn-compatible registry
⚡Zero config: self-contained, with sensible defaults and typed props
🤖MCP ready: let your AI assistant find and install components for you

Quick start

Add a component with the shadcn CLI (run npx shadcn@latest init first if you have not):

npx shadcn@latest add @canvas-ui/liquid-react

Swap liquid for any component, react for solid, preact, vue, svelte, or vanilla. Source lands in components/canvasui/, yours to edit.

import { Liquid } from "@/components/canvasui/Liquid";

export default function Page() {
  return (
    <Liquid>
      <YourEntirePage />
    </Liquid>
  );
}

Most components wrap your content. The subtree stays live and interactive; the effect runs on top.

See the installation guide for manual setup.

WebGL and WebGPU

Every effect ships in two renderer builds. The WebGL build is the default: raw WebGL2 and GLSL, zero dependencies except three for the object effects. The WebGPU build renders through vgpu with WGSL shaders, keeps the same props and public API, and installs with the -webgpu registry suffix:

npx shadcn@latest add @canvas-ui/liquid-react-webgpu

WebGPU builds ship for all six frameworks. They need a browser with WebGPU, Chrome/Edge 113+, Safari 26+ / iOS 26, or Firefox 141+. If WebGPU is missing, the wrapped content renders unchanged. Details in the rendering guide.

Components

Every component ships for all six frameworks in both renderer builds. Compare them in the playground.

🌊 Fluid & motion
ComponentWhat it doesComponentWhat it does
LiquidPointer-driven fluid simulationRippleWater ripples from every click
ClothFabric rippling in the windDropletsRain running down the screen
BubbleMetaball droplet trailing the cursorDisplacementGrid that ripples away from the cursor
🔥 Fire & energy
ComponentWhat it doesComponentWhat it does
BlazeSparks, smoke, and heat distortionFlame WrapBorder of fire around any element
Force FieldEnergy shield with click shockwavesLaserBeam that reveals content on scroll
💎 Glass & optics
ComponentWhat it doesComponentWhat it does
GlassCrystal-ball lens that follows the cursorFrostIce that melts under the cursor and refreezes
MagnifySci-fi scanner lens with a HUD reticleBendFolds the page like the face of a cube
PeelPeels back to reveal a second layerCloudsMist parted by cursor wind
📼 Retro & glitch
ComponentWhat it doesComponentWhat it does
VHSWorn tape wave, chroma bleed, and grainGlitchBroadcast tearing with RGB splits
Retro DitherDither lens that pixelates the pageAsciifyASCII lens that follows the cursor
Decrypt RevealCipher text decrypting at the cursorGlyph RainFalling glyphs that light up the page
✨ Particles & structure
ComponentWhat it doesComponentWhat it does
Particle RevealParticles merging into crisp UIParticle ScrollSand that reassembles on scroll
Shatter3D glass shards that lift and refractGrid3D tiles rippling around the cursor
Hex FloatFloating hex tiles with cursor liftCanvasWoven canvas you drag wet paint across
🧊 3D effects: no flag needed, these work everywhere

Point these at a GLB/glTF model, SVG, or image to render it as a 3D scene.

ComponentWhat it doesComponentWhat it does
ASCII ObjectRedrawn as shape-matched ASCIIGlass ObjectLiquid glass with real dispersion
Particle ObjectParticles that scatter and spring backDithered ObjectRendered through a 1-bit dither
Liquid ObjectDragged through swirling liquid

Browser support

BrowserHTML-in-canvas components3D effect components
Chrome with the flag or origin trial✅ Full effect✅ Full effect
Everything else⚠️ GPU overlay fallback✅ Full effect

Html-in-canvas needs Chrome with the chrome://flags/#canvas-draw-element flag. An origin trial token lifts that for your visitors. That is how canvasui.dev runs in a plain Chrome install. Details in the docs.

Chrome 150's changes to texElementImage2D() and copyElementImageToTexture() do not require a migration in Canvas UI. The HTML effects capture content with the 2D drawElementImage() API, then upload the canvas with standard texImage2D() (WebGL) or copyExternalImageToTexture() (WebGPU). Those upload methods keep their existing signatures. This also applies to the generated registry components for all six frameworks.

The later HTML-in-Canvas changes also affect capture markup and hit testing. Canvas UI synchronizes the captured element's geometry when the browser requires it, keeping scrolling, clicks, and cursor effects working in Chrome 154. It also selects content="drawable" and drawable when the newer API is available, while preserving support for layoutsubtree and automatic 2D geometry synchronization.

Both renderers follow pinch zoom through visualViewport, increasing capture and rendering resolution while preserving the HTML's position and interactions. The normal 2× device-pixel-ratio budget is multiplied by the zoom scale, subject to GPU limits, an 8192-pixel maximum dimension, and a 16-megapixel buffer budget. Particle Scroll uses plain HTML without a GPU overlay when HTML-in-Canvas is unavailable, including in Safari.

Use with AI

The registry is MCP ready, so your assistant can browse and install components:

npx shadcn@latest mcp init --client claude

Works with Claude Code, Cursor, VS Code, Codex, and OpenCode. Then just ask: "add the Liquid component from Canvas UI".

Development

This repo holds the library source, the docs site (Next.js 16, Tailwind v4, on Cloudflare Workers), and the registry build.

npm install
npm run dev        # builds the registry, then starts next dev
npm run build      # production build
npm run deploy     # build and deploy to Cloudflare
PathWhat lives here
src/lib/<Component>/WebGL and WebGPU engines plus framework wrappers
src/demos/Interactive demo and controls for each component
src/app/Documentation site routes
scripts/build-registry.mtsGenerates public/r/*.json for the shadcn CLI

Each component is plain TypeScript with thin framework wrappers. WebGL builds use raw WebGL2 and GLSL. WebGPU builds use vgpu and WGSL. Nothing depends on another Canvas UI component, and each engine defines its own props.

Contributing

Issues and pull requests welcome. See CONTRIBUTING.md.

License

MIT + Commons Clause. Free in your own projects, commercial or not. The Commons Clause only restricts selling the library itself.

animation
canvas
component-library
components
creative-coding
design-engineering
frontend
glsl
nextjs
react
shadcn
shaders
svelte
threejs
typescript
ui
ui-library
vue
weggl

Significant stargazers

(top 24 of 76)

btea

309 followers · starred Aug 2026

fregante

1,983 followers · starred Jul 2026

Yuan-Man

579 followers · starred Jul 2026

0xflotus

496 followers · starred Aug 2026