Material
Draw the surface of frosted glass material, which can be overlapped with text and graphics to form a content area. type currently supports frosted, style controls the material thickness; the visible effect depends on the content behind it.
Example
function main() {
return (
<ZStack>
<Material type="frosted" style="thin" />
<Text>CapDrive</Text>
</ZStack>
);
}
Usage
- Material is a surface with no children or padding. Overlay text with ZStack; frosted appearance depends on what is behind it. type currently accepts frosted, while style selects thickness. Image textures are not accepted.
- mask uses alpha: opaque areas reveal, transparent areas hide. Black and white with equal alpha behave identically. A mask does not affect the subject’s layout; size it explicitly and distinguish it from clipped bounds.
Properties
type"frosted"Material kind. Currently frosted draws native frosted glass.
"frosted"style?"ultraThin" | "thin" | "regular" | "thick" | "ultraThick" | "bar"Frosted material appearance, from ultraThin to ultraThick; bar uses the system bar material.
"ultraThin"Common properties
width?number | "auto" | "fill"Width in points, auto sizing or parent fill.
100height?number | "auto" | "fill"Height in points, auto sizing or parent fill.
80x?numberVisual offset in points: x moves right, y moves down. Does not change layout space.
0y?numberVisual offset in points: x moves right, y moves down. Does not change layout space.
0transform?ViewTransformTransform the whole View without changing layout. Translation uses points; rotation/skew use degrees; scale 1 is unchanged; anchors use 0–1.
{rotation: 0}background?PaintBackground paint; accepts a color or gradient. Use clear for transparency.
"clear"opacity?numberOpacity of the whole View: 0 is transparent, 1 is opaque.
1cornerRadius?numberCorner radius in points.
0clipped?booleanClip drawing that extends beyond the View bounds.
falseclip?boolean | "rectangle" | "ellipse"Clipping shape: rectangle or ellipse. Material also accepts false to disable clipping.
"rectangle"mask?View | nullAlpha mask View. Centered without affecting layout; null disables masking.
<Circle width="fill" height="fill" background="white"/>zIndex?numberDrawing order among siblings; larger values appear in front.
0blur?numberBlur radius in points; 0 disables blur.
4innerShadow?DrawingEffectEffect color, opacity, blur radius and x/y offset. Distances are in points.
{color: HDR("black"), opacity: 0.5, radius: 4, x: 0, y: 2}glow?DrawingEffectEffect color, opacity, blur radius and x/y offset. Distances are in points.
{color: HDR("cyan"), radius: 8, opacity: 0.8}shadowColor?ColorColor of the outer shadow.
HDR("black")shadowOpacity?numberOuter shadow opacity from 0 to 1; 0 hides it.
0shadowRadius?numberOuter shadow blur radius in points.
4shadowX?numberOuter shadow offset in points: x right, y down.
0shadowY?numberOuter shadow offset in points: x right, y down.
2animations?Animation[]Animate a supported property when it changes. duration/delay use seconds; from/to set endpoints; repeat and autoreverse control repetition; wrap sets a periodic range.
[{property: "opacity", duration: 0.25, curve: "easeInOut"}]key?string | numberStable identity among siblings.
Practical example
function main() {
return (
<ZStack width={200} height={100}>
<HStack spacing={0} width="fill" height="fill">
<Rectangle width="fill" height="fill" background="blue" />
<Rectangle width="fill" height="fill" background="orange" />
</HStack>
<Material
width={160}
height={64}
type="frosted"
style="thin"
cornerRadius={16}
/>
<Text fontSize={28}>78 km/h</Text>
</ZStack>
);
}
Animation
widthheightxyopacitybackgroundcornerRadiusblurshadowColorshadowOpacityshadowRadiusshadowXshadowYtransform.translateXtransform.translateYtransform.scaleXtransform.scaleYtransform.rotationtransform.skewXtransform.skewYtransform.anchorXtransform.anchorYWhen omitted
The table lists omission behavior verified against implementation. Property examples are copyable syntax, not defaults. Pass explicit values for a fixed result; contextual dimensions and theme colors are not fixed constants.