Visual effects
The CSS effects a web UI leans on, as style properties: backdrop blur, filters, masks, layered backgrounds, viewport units, percent transforms, currentColor and inherited pointer-events. Every renderer draws them alike (D3D11, Vello and the CPU renderer).
Properties
| Style | Meaning |
|---|---|
backdropBlur: 12, backdropFilter: "blur(20px) saturate(160%)" | CSS backdrop-filter: what is painted behind the box shows through blurred (no lens or rim, unlike glass). backdrop-blur-* in Tailwind. |
filter: "blur(90px)" | CSS filter: blur(). A solid box without children blurs as it paints (cheap glows); anything else is painted through the filter. blur-* in Tailwind. |
filter: "drop-shadow(x y blur colour)" | A shadow of what the box paints (an icon's shape, text), combinable with blur(). |
maskImage: "linear-gradient(…)" | CSS mask-image with a gradient: the box and its content keep the gradient's alpha. Linear, radial and conic gradients. |
background: "g1, g2, …, base", backgroundLayers | CSS multiple backgrounds: layers over the bottom background, the first on top. |
"50vh", "100vw", "10vmin", "10vmax" | Viewport units in lengths, insets and margins; resolved to px for the window and again on resize (dvh/svh/lvh are accepted). |
transform: "translateX(-100%)" | Percent translations are of the box's own width/height, as in CSS (a shimmer that sweeps its own width). Paint-time: hit testing follows, layout does not. |
foreground: "currentColor" | The nearest ancestor's foreground, in its hover/group-hover state: <Svg color="currentColor"> follows its button's colour. |
pointerEvents: "none" | The pointer falls through the box. It inherits as in CSS: children without a value fall through too, a child with "auto" takes the pointer again. |
Backdrop blur
// frosted search pill: what lies behind, blurred
<Row style={{ height: 44, radius: 22, background: "#ffffff18",
backdropFilter: "blur(20px) saturate(160%)",
borderWidth: 1, borderColor: "#ffffff22", focusWithin: { borderColor: "#e50914" } }}>
<Input placeholder="Search" />
</Row>The box's background tints the blurred backdrop, so give it some transparency. For the liquid-glass material (refraction, rim, sheen) use glass or the Glass component instead.
Blur and drop shadow
// a soft red glow behind the page
<View style={{ position: "absolute", left: -120, top: -80, width: 420, height: 420, radius: 999,
background: "#e5091455", filter: "blur(90px)" }} />
// a shadow that follows the icon's shape
<Icon name="play" size={48} color="#fff" style={{ filter: "drop-shadow(0 2px 6px rgba(0, 0, 0, 0.6))" }} />A filtered subtree other than a plain box is rasterized on the CPU and drawn as an image. It is drawn again only when what it paints changes (a cheap hash of its paint commands decides), so static icons with shadows cost nothing per frame; animate the filtered box's position or opacity rather than its content.
Masks
// a hero backdrop fading out at the bottom
<Image src={backdrop} fit="cover" style={{ position: "absolute", inset: 0,
maskImage: "linear-gradient(to bottom, black 55%, transparent)" }} />Several backgrounds
<View style={{ flex: 1,
background: "radial-gradient(circle at 20% 0%, #e5091433, transparent 60%), radial-gradient(circle at 100% 100%, #7c3aed22, transparent 50%), linear-gradient(#0b0b0f, #050507)" }} />Viewport units
<View style={{ height: "60vh", minHeight: 320, padding: { left: "5vw", right: "5vw" }, maxWidth: "90vmin" }} />A view that uses them renders again when the window is resized, like one that reads viewport(). For looping animations (shimmer, pulse, slow zoom) see Motion.