Skip to main content
Glassen’s React entry point mounts and releases the renderer with your component. Import the layout stylesheet once and initialize the WASM asset before rendering the application.
Children are captured with modern-screenshot. DOM mutations, size changes and font loads invalidate the snapshot. This does not capture arbitrary content behind the component. Use an explicit source for canvas animation or GPU content; liveChildren requests repeated DOM captures and can be expensive.

Stationary content, moving glass

GlassContent requires GlassSurface. Lenses without their own source sample the shared scene. A source prop takes precedence over children. Shared surfaces own one WebGL context and animation clock; individual lenses keep independent spring state. Glass accepts the lens options, plus size, style, label, children and liveChildren. The default size is 480 CSS pixels. GlassSurface accepts style, className and onReady(surface) for reading statistics. Keep React state updates out of the frame loop; use DOM transforms in onMove, or position the lens through your application’s existing motion layer. The component responds to arrow keys as well as pointer drags. interactive={false} disables these handlers. Keep important text and controls accessible in DOM; a rendered texture does not provide semantics.