--- name: liquid-glass description: > Build and reuse the "liquid glass" refraction UI in components/grid-wallet-demo (the LiquidGlass / Glass / GlassOver components). Use this skill when the user asks for a glass / liquid-glass / frosted / refraction / squircle UI element — e.g. "make a glass button", "glass tab bar", "glass card", "glass panel", "glass nav", "make this glass", "glass border that expands on hover", "frosted surface", or to tune the glass effect (refraction, chroma, specular, blur, corner smoothing, shadow). allowed-tools: - Read - Glob - Grep --- # Liquid Glass Reusable refraction glass for `components/grid-wallet-demo`. Full docs: **`components/grid-wallet-demo/src/components/liquid-glass/README.md`** — read it before implementing anything non-trivial. ## The rule that prevents 90% of the pain **The glass refracts its own CHILDREN, not the page behind it.** There is no "frost whatever is behind me" mode (`backdrop-filter` can't refract portably). To bend a background you put a *copy* of it inside the glass. So: - Glass over a **known** backdrop (color / gradient / image / pattern) → use `GlassOver`, which makes the copy for you. - Glass over **live UI behind a small surface** (over a *static* screen) → achievable: feed the glass a positioned **copy** of that UI. See "Refract live UI behind a small surface" in the gotchas / README. - Glass over **arbitrary scrolling/animating DOM** → not achievable. Tell the user. Exception: a **big** frosted surface (sheet/modal) should NOT refract — the per-frame SVG filter tanks Safari. Use `FrostPanel` (GPU `backdrop-filter` + a specular edge). Refraction is for the small, tactile elements. Skipping this gives a flat panel that doesn't lens (the classic failure). ## Pick the right entry point | Need | Use | |---|---| | Glass button / tab bar / card / chip over a known bg | `GlassOver` (easiest) | | Refract content you already render, or custom backdrop wiring | `Glass` (= `LiquidGlass`) | | A big frosted sheet/modal (no refraction — fast on Safari) | `FrostPanel` (`BottomSheet` uses it) | | A small surface that refracts the (static) screen behind it | `GlassOver`'s `backdropNode` | | A lens over the LIVE aurora that must work on Safari | WebGL: `AuroraLensButton` (circle) / `AuroraLensPanel` (rect squircle) | | The phone preview's WebGL stage | `glass-gl/StageGL` — **bespoke, don't reuse** | **SVG vs shader (which renderer):** **default to the SVG path** (`Glass` / `GlassOver`) for anything made of **live DOM** — buttons, tab bars, cards, text, layouts (keeps content selectable/clickable). The **shader / WebGL** path is only needed when you're refracting content that is **not** live DOM — a `` drawing (e.g. a generated QR) or a `