Skip to content

Introduction

PolyCSS renders 3D meshes in the DOM. No WebGL, no canvas-as-scene: the rendered output is a tree of standard DOM elements positioned with transform: matrix3d(...). Each visible polygon becomes one leaf DOM node you can inspect in DevTools, target with CSS, or attach events to.

Internally, the renderer chooses the cheapest CSS strategy per polygon. Solid rectangles, stable quads, triangles, and clipped solids can render as CSS primitives; textured polygons and unsupported shapes fall back to generated atlas slices. Atlas rasterization happens once at mount, then camera, mesh, and light updates flow through CSS transforms and custom properties.

PolyCSS is vanilla-first. The default entry point is custom elements (<poly-camera>, <poly-scene>, <poly-mesh>, <poly-polygon>, controls, helpers, and shapes) plus imperative APIs such as createPolyCamera, createPolyScene, and createPolyOrbitControls: no framework required. First-class bindings for React and Vue ship as separate packages on top of the same engine. Pick whatever fits your stack.

Terminal window
npm install @layoutit/polycss

You can also load PolyCSS directly from a CDN with no build step:

<script type="module" src="https://esm.sh/@layoutit/polycss/elements"></script>

Render a 3D shape with zero JS: just custom elements:

<script type="module" src="https://esm.sh/@layoutit/polycss/elements"></script>
<poly-camera rot-x="65" rot-y="45">
<poly-scene>
<poly-icosahedron size="100" color="#ff6644"></poly-icosahedron>
</poly-scene>
</poly-camera>

Or with React:

import { PolyCamera, PolyScene, PolyIcosahedron } from "@layoutit/polycss-react";
export function App() {
return (
<PolyCamera rotX={65} rotY={45}>
<PolyScene>
<PolyIcosahedron size={100} color="#ff6644" />
</PolyScene>
</PolyCamera>
);
}

Continue to Quickstart → for the full walkthrough with Vanilla JS, React, and Vue versions.

  • Quickstart: Full install + first scene walkthrough.
  • Core Concepts: The mental model: PolyScene, PolyMesh, Poly, polygon data, pipeline.
  • PolyCamera: Camera component reference.
  • PolyScene: Scene component reference.