Glass Pane
A pane of glass that bends and splits the light of whatever is behind it at its edges, with a calm center for content.
pixikit.com/docs/components/glass-pane
Customize
Width320px
Height76px
Border radius38px
Refraction
Renderer
Distortion scale-180
Border width0.07
Blur11px
Brightness50%
Opacity0.93
Displace0.5
Red offset0
Green offset10
Blue offset20
Background opacity0.10
Saturation1.00
X channel
Y channel
Mix blend mode
Props
24| Name | Type | Default | Description |
|---|---|---|---|
children | ReactNode | None | Content shown on the glass. |
width | number | string | 200 | Width in px, or any CSS value like '100%'. |
height | number | string | 80 | Height in px, or any CSS value like '100vh'. |
borderRadius | number | 20 | Corner radius in px. Not used with a shape. |
shape | string | None | URL of an SVG or transparent PNG that gives the glass its outline, fitted inside the width and height. Files from another origin need CORS headers. |
refraction | boolean | true | Bends what is behind the glass at its edges. Set it to false to use the frosted glass look everywhere. |
renderer | "auto" | "svg" | "webgl" | "auto" | How the glass bends light. Auto uses SVG filters in Chromium, which bend anything behind the glass, and WebGL in Safari and Firefox when a backdrop is given. Without a backdrop, those browsers get a frosted glass look. WebGL forces the WebGL glass whenever a backdrop is given. |
backdrop | RefObject<HTMLImageElement | HTMLVideoElement | HTMLCanvasElement | null> | None | The image, video or canvas behind the glass. WebGL can only bend what it is given, so pass this to get real refraction outside Chromium. Images from another origin need CORS headers. |
distortionScale | number | -180 | How strongly the edge bends what is behind it. Negative values pull the view inward. |
borderWidth | number | 0.07 | Width of the bending edge, as a fraction of the shorter side. |
blur | number | 11 | Softness of the transition from the bending edge to the calm center, in px. |
brightness | number | 50 | Brightness of the calm center, in %. 50 leaves it undistorted. |
opacity | number | 0.93 | How strongly the calm center holds the view still, from 0 to 1. |
displace | number | 0 | Blurs the light coming through the glass, for a frosted look. |
redOffset | number | 0 | Extra bending for the red channel. Different offsets split light into colored fringes. |
greenOffset | number | 10 | Extra bending for the green channel. |
blueOffset | number | 20 | Extra bending for the blue channel. |
backgroundOpacity | number | 0 | Opacity of a soft frosted tint over the glass, from 0 to 1. |
saturation | number | 1 | Saturation of what is seen through the glass. |
xChannel | "R" | "G" | "B" | "R" | Channel of the displacement map that moves pixels sideways. |
yChannel | "R" | "G" | "B" | "G" | Channel of the displacement map that moves pixels up and down. |
mixBlendMode | CSSProperties["mixBlendMode"] | "difference" | How the two edge gradients of the displacement map are combined. |
className | string | "" | Extra class names for the glass. |
style | CSSProperties | {} | Inline styles for the glass. |