ZeroGravity UI

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.10strength
0.80dispersion
0.70sheen
Glassthe slab itself: how it leans and how thick it is
14 °tilt
18 pxdepth
facets
8 pxpixel
4 pxradius

Usage

TSX
<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

11 documented props on Prism
PropertyTypeDefaultDescription
strengthnumber1.1Strength. Range 0 to 2.
dispersionnumber0.8Dispersion. Range 0 to 1.
sheennumber0.7Sheen. Range 0 to 1.
tiltnumber14Tilt. Range 0 to 30 °.
depthnumber18Depth. Range 0 to 48 px.
facets"pixel" | "smooth""pixel"Facets.
pixelnumber8Cell. Range 4 to 20 px.
radiusnumber4Radius. Range 0 to 48 px.
childrenReactNode—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.
disabledbooleanfalseHolds 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.