
liquid-glass: iOS 26 frosted glass for Compose Multiplatform with a zero-alloc fallback for low-RAM Android
Hi everyone, sharing a new Compose Multiplatform library I open-sourced today.
liquid-glass adds iOS 26-style frosted backdrop surfaces to CMP. The API is Modifier.liquidGlass() plus three composables: GlassCard, GlassButton, GlassNavBar.
The bit I'm proudest of is the auto-tiered fallback. Three quality tiers picked per platform:
- Full on Android 12+ (non-low-RAM) and iOS 17+: 24dp blur, 1.4x saturation, full-res backdrop.
- Medium on iOS 15 to 16: 16dp blur, 0.5x downsampled backdrop.
- Fallback on Android < 12, isLowRamDevice, or iOS < 15: zero offscreen buffers, no blur, just a flat tint with edge sheen.
Fallback allocates zero GraphicsLayers, so the same code that draws frosted glass on a Pixel 9 quietly draws a flat tint on a 2GB Android 11 device. No OOM, no per-call-site branching.
Targets: Android, iOS (arm64 + simulator), Desktop (JVM), Wasm/JS. Apache 2.0, on Maven Central as 0.1.0.
Quick start:
```kotlin
val state = rememberLiquidGlassState() // auto-picks tier for the device
Box(Modifier.fillMaxSize()) {
Image(
painter = painterResource(R.drawable.scenery),
contentDescription = null,
contentScale = ContentScale.Crop,
modifier = Modifier.fillMaxSize().liquidGlassSource(state),
)
GlassCard(
state = state,
modifier = Modifier.align(Alignment.Center).padding(24.dp),
) {
Text("Frosted, light-refracting surface")
}
}
```
Credit where it's due: Chris Banes's haze library solves backdrop-blur in Compose really well and is more mature than this. I built liquid-glass because I wanted the tiered fallback baked in by default, not as a thing each consumer has to wire up.
Limitations: 0.1.0. No GlassDialog or GlassBottomSheet wrappers yet, no Sk SL refraction shader, no dynamic-color edge sheen sampled from the backdrop. All on the roadmap.
Repo: https://github.com/NadeemIqbal/liquid-glass
Happy to answer questions about the per-platform auto-detection or the GraphicsLayer sampling approach.