Glass Key
A 3D glass keycap with liquid light that follows your cursor.
Features
- •Real glass — Rendered with Three.js physical glass: light bends through it, edges catch soft reflections, and you can tint or frost it.
- •Light inside — A shader core drifts with slow, liquid colour. Pick its three colours, speed and brightness to match your brand.
- •Turns with the cursor — The key leans towards the pointer and eases back when it leaves. Set how far, or switch it off.
- •Your label — Print any short label on the key: esc, ⌘, a letter or your logo word.
- •Drop in anywhere — Fills its parent with a transparent background, so it sits on any section. The view refits on resize and on phones.
- •Light on resources — Pauses offscreen, caps the pixel ratio, holds still with reduced motion, and cleans up the WebGL context when removed.
Props API Reference
13 configurable props| Prop | Type | Default | Description |
|---|---|---|---|
| label | string | "dot" | Text printed on the top of the key. |
| labelColor | string | "#FFFFFF" | Label colour. |
| colors | [string, string, string] | ["#030304", "#3A3A40", "#FFFFFF"] | Inner light: base, glow and highlight colours. |
| speed | number | 1 | Speed of the movement inside the key. |
| intensity | number | 0.4 | Brightness of the inner light (0–2). |
| glassColor | string | "#FFFFFF" | Glass tint; white is clear. |
| roughness | number | 0 | Frosting of the glass (0–1); 0 is perfectly clear. |
| tilt | number | 18 | How far the key turns towards the pointer, in degrees. |
| rotation / lean | number | -32 / 32 | Resting turn and lean towards the viewer, in degrees. |
| size | number | 0.4 | Share of the shorter side the key fills (0.2–0.9). |
| interactive | boolean | true | Follow the pointer. |
| ariaLabel | string | "Glass {label} key" | Description for screen readers. |
| className / style | string / CSSProperties | undefined | On the root; it fills its parent. |