# VS Modules / Glass VisualSystem’s standalone glass material for any design system. Copy the source into the project and adapt it to the existing framework. React is the reference's only dependency; no package, service, scene capture or duplicated content is required. ## Use Save Glass renders a div by default; as also accepts button, a or section. Native attributes and events are forwarded; buttons default to type="button". The host owns content, sizing, labels, state and accessibility. Children stay mounted as options change. Refs are not forwarded. Do not nest interactive hosts. Inputs use the CSS material because they cannot contain SVG definitions. Three material props, all clamped to 0–1: - intensity: edge refraction, default .8. Zero disables the lens and its observer. - frost: blur and tint together, default .02. Zero has no blur; one is frosted (20px blur). With zero Fill the default tint is 8.8%. - fill: page-color backing, default 0. Use 1 for the filled black-glass treatment, .45 for partial backing or 0 for clear glass. Independent of Frost. mode="light" | "dark" defaults dark. Fill uses #080808 in dark and #fdfdfd in light; match the host page to these colors for the rim-only appearance. Highlight is fixed; refraction spans a curved band up to 18% of the shorter side (capped at 48px), with cubic falloff to a nearly neutral center, separate from the 1px material border. Corners default to 24px; use style.borderRadius with a uniform pixel radius when needed. The lens reads the rendered radius on mount, resize and borderRadius/className changes. Avoid animated geometry, elliptical corners or overriding backdrop-filter. The material supplies matching foreground color for labels and icons; font inherits from the host. By default, light glass uses dark content and a near-white backing; dark glass uses light content and a near-black backing. Set contentMode="dark" for light text and controls over imagery while retaining a light glass backing. Both have a restrained rim and inset lighting, without a center glow or drop shadow. Hover and keyboard focus use a subtle surface change. Native buttons and links compress slightly and light at the press location, then ease back on release; reduced motion disables the scale response. aria-pressed and aria-checked retain a selected veil. A wrapper around an input highlights on keyboard focus. The border stays unchanged; never add focus outlines or rings. ## Rendering One backdrop filter per surface, with page-color backing and restrained edge lighting. For Fill below 1, Chromium adds an SVG lens with a curved rim and cubic falloff that keeps interior sampling nearly neutral. Displacement scales with the shorter side, up to 64px at full intensity (128px SVG scale); its map is capped at 256px on the longest axis and rebuilt only for geometry changes. While a surface resizes, the current map stretches to its live size each frame and is rebuilt at most every 80ms and once at rest. Intensity and Frost adjustments reuse it. Full Fill hides backdrop refraction and skips the lens and its observer. The lens has no idle animation loop, page cloning, WebGPU or background image fetch. No image sampling or scroll listeners are needed. Keep surfaces bounded and avoid many nested filtered layers. Safari and Firefox retain CSS glass. This approximates native page-backed Liquid Glass with a CSS backing and rim. A web backdrop filter cannot refract its own fill like the native compositor: full Fill is opaque and the rim supplies its glass appearance; lower Fill reveals backdrop blur and refraction. Reduced transparency and forced colors disable blur/refraction and stop observer work; missing backdrop support uses an opaque fill. Canvas restrictions retain the CSS fallback. Strict CSP must allow inline styles and the data-image map; otherwise serve local CSS with intensity={0}. Verify contrast and desktop browser appearance before publishing. The source also exports glassDefaults, glassSurfaces, glassOptions, glassMaterial(mode, options, contentMode=mode) and glassMaterialCSS(selector, prefix="vs-glass"). The latter two provide the same material as scoped CSS tokens, without the React lens. Define values as --vs-glass-{name}. The playground offers Material (the default: a movable glass pill, capped at 300 × 160px, over centered, bold, stacked Liquid Glass typography) and Controls (a pill button, an ellipsis button that morphs into its menu, a draggable switch and segmented selector, a slider and search). Motion uses damped springs set by response and damping ratio that keep velocity when interrupted, with one frame loop that stops at rest. Held selection and thumbs lift into translucent lenses, stretch with velocity and spring to the committed stop; dragging past an end flexes the control with rubber-band resistance. Buttons grow under the pointer, lean toward a drag and spring back. The ellipsis menu grows out of its trigger as one glass body; press, drag onto an item and release to select it. Segment and switch drags commit at release; cancellation restores the selection. The slider retains native range keyboard and touch handling. Reduced motion jumps to final states; reduced transparency keeps thumbs opaque. These playground gestures are examples, not built into the Glass primitive. The controls compose Glass with native elements and host-owned state; no extra component library is required. A search field can be a Glass div containing a transparent native input; a switch uses Glass as="button" with role="switch", aria-checked and an onClick handler. Keep resting child controls unfiltered inside a Glass group; the playground uses a small CSS-only lens while dragging. Avoid stacking SVG refraction layers. The playground shares Intensity/Frost/Fill sliders and Light/Dark tone presets with None and Surface background tabs. None is the default background and uses a plain surface matching the selected tone; Surface uses the wallpaper. Surface previews use light text, icons and control fills with either glass tone. On None, content contrasts with the selected tone. The optional contentMode prop overrides content contrast independently of mode (dark gives light content; light gives dark content); full Fill and opaque fallbacks restore readable content for their backing. Moving across the backdrop never changes the selected tone or content color. Every refresh restores Material, Dark tone and None background; all settings and movement reset without saved preferences. Dragging snaps to each center axis with temporary dashed guides; click-to-position and arrow keys also move the specimen; Home centers it and Escape cancels a drag. These preview interactions and artwork are not part of the component API. VisualSystem Modules are custom, locally owned implementations. Use the supplied source for all module UI and effects; do not install an npm effect package, substitute another library, or direct users to a reference project. Research references are for study only. Adapt to the host framework without adding React or another framework. Existing QR, PDF and Apple Wallet format libraries are allowed only for encoding and file generation. Preserve required artwork and font license notices. Example: https://visual.systems/api/modules/glass/example.tsx