Surfacesexperimental
Prism
Glass refraction
A slab of glass that takes the pointer as its light source: the content splits into red, green and blue, the edge turns to a rainbow and a spectrum falls behind it.
White light in
Refraction
Every edge splits into red, green and blue, pushed apart along the light.
Drag on touch screens. Under reduced motion the light rests in the top left corner.
Customize
Opticshow hard the glass bends and splits the light
1.10
strength0.80
dispersion0.70
sheenGlassthe slab itself: how it leans and how thick it is
14 °
tilt18 px
depthfacets8 px
pixel4 px
radiusUsage
<Prism
strength={1.1}
tilt={14}
depth={18}
dispersion={0.8}
>
<Card />
</Prism>Generated from the controls above. Only props that differ from their defaults are shown.
Props
| Property | Type | Default | Description |
|---|---|---|---|
strength | number | 1.1 | Strength. Range 0 to 2. |
dispersion | number | 0.8 | Dispersion. Range 0 to 1. |
sheen | number | 0.7 | Sheen. Range 0 to 1. |
tilt | number | 14 | Tilt. Range 0 to 30 °. |
depth | number | 18 | Depth. Range 0 to 48 px. |
facets | "pixel" | "smooth" | "pixel" | Facets. |
pixel | number | 8 | Cell. Range 4 to 20 px. |
radius | number | 4 | Radius. Range 0 to 48 px. |
children | ReactNode | — | Whatever sits inside the glass. Stays interactive. |
pointer | { x: number; y: number } | — | Pins the light to a point, 0 to 1 in the slab's own box, instead of following the pointer. |
disabled | boolean | false | Holds the light at rest and ignores the pointer. |
Dependencies
0 external runtime dependencies
Ships with nothing but React.
Experimental: still under evaluation and not part of the published package yet.