The opacity level, from
0 (fully transparent) to 1 (fully opaque).Support
Usage
Semi-transparent component
Fading an image
Animated fade
Disabled appearance
Notes
- Unlike
.hidden(), a component with.opacity(0)still occupies layout space and remains hittable (responds to tap gestures). Use.allowsHitTesting(false)in combination with.opacity(0)to make it non-interactive. - Opacity applies to the entire component subtree, including all children.
See Also
- hidden — hides a component and removes it from hit testing
- grayscale — desaturates the component
- brightness — adjusts brightness