The scroll edge effect and the collapsing bar¶
Two things happen at the top of an iOS 27 screen when content scrolls under the chrome: the content is blurred
(and, in a dark appearance, dimmed) where it passes under the bar, and the bar itself may collapse. The first is
a modifier, Modifier.glassScrollEdge; the second is a recipe, because the
collapse is the app's own layout, not an effect.
Provenance, in every table below: measured is read from Scr-safari-scroll-{dark,light} (iOS 27 Safari, an
iPhone, 60 fps, HDR10 decoded); fitted is our parameterisation of a measurement; authored is not visible in
any recording we have.
The scroll edge effect¶
Put the modifier on the scrolling container. It draws over the content and under the sibling chrome, and it never consumes scroll:
val state = rememberLazyListState()
LazyColumn(
modifier = Modifier.glassScrollEdge(state, ground = MyTheme.ground, inverted = isDark),
state = state,
) { /* items */ }
With a ScrollState the call is the same. With Material 3, drive it from the app bar's own signal, so the effect and
Material's collapse share one number:
val behavior = TopAppBarDefaults.exitUntilCollapsedScrollBehavior()
LazyColumn(
Modifier
.nestedScroll(behavior.nestedScrollConnection)
.glassScrollEdge(behavior, ground = MyTheme.ground, inverted = isDark),
) { /* items */ }
| value | label | |
|---|---|---|
| Blur | on in both appearances; edges stay smeared across the band and are sharp again 35 dp from the edge | measured: edges 4.4 px wide 22 dp in, 3.0 at 28, 1.5 at 32, 0.4 at 35 (3x pixels, rms over +-10 rows) |
| Blur masks | two blurred copies (3.3 dp and 1 dp) over the sharp content | fitted to those widths (within 1 px); above 20 dp the widths are only lower bounds |
| Dark tint | 0.41 (1 - smoothstep(10 dp, 34 dp, d)) toward grey 124, the same for every hue |
measured, 0.8 level rms against the measured profile (the gate was 5) |
| Light tint | none | measured (1 to 3 levels, no consistent sign) |
| Fade-in with scroll | 24 dp of scroll, from 0 at rest | authored |
| Bottom edge | a mirror of the top | authored: the take's bottom edge sits under the glass toolbar |
Notes:
inverted = trueis the dark appearance: the tint. In a light appearance the effect is blur only. Drive it from the same decision that picks the glass's appearance.- The blur needs a render effect: Android 12 and later, desktop and web. Before Android 12 only the tint draws.
- While the modifier's intensity is zero (at rest, at the end of a list) it draws exactly as if it were absent.
groundis used byGlassScrollEdgeStyle.Hardonly (a uniform band, the older composable's look). The measured effect does not fade toward the app's ground.- A taller bar: iOS measures from the bar's own edge, which was not measured here. The
heightparameter scales the measured profile, so a taller bar can stretch it; that stretching is authored.
GlassScrollEdge, the composable, stays for a chrome that does not sit on a
scrolling container. It is always drawn and its numbers are authored.
Before and after renders, with their captions and limits:
review/atlas/scroll-edge-2026-11-18.
A large title that collapses¶
Material already does this, scroll-driven, so there is nothing to measure and no new API: use
LargeTopAppBar(scrollBehavior = exitUntilCollapsed) with the modifier above. The recording has no large title;
the collapse is Material's.
Safari's bar collapsing to a pill¶
In the take, Safari's bottom bar (back, address capsule, tabs) collapses to a compact address capsule while the page scrolls, and expands again. The page prints its scroll offset in the margin; decoding it frame by frame (checked against the take's scripted scrolls, whose speeds it reads back within 0.06 %) gives the trigger and the timing:
| value | label | |
|---|---|---|
| What drives it | the finger only (on the recorded iPhone): scripted scrolling (to 800 pt/s, 4,920 pt of travel) and fling settle never collapse it | measured |
| Collapse | after about 36 pt of downward scroll (the finger travelling up) since the last reversal, mid-drag (commits at +23 to +45 pt; +23 to +29 pt only squeezes it and springs back) | 36 pt fitted |
| Expand | after about 72 pt of upward scroll (the finger travelling down), twice the collapse distance (commits at 70 to 78 pt) | 72 pt fitted |
| Shape | the capsule narrows from about 211 pt to 125 pt and drops about 28 pt; the side buttons fade | measured |
| Easing | cubic-bezier(0.25, 0.1, 0.25, 1) over 325 ms (1 % to 99 % in 270 to 286 ms); beats a critically damped spring 1.3x to 7x in rms |
fitted |
| Side buttons | fade out over 180 ms on collapse; fade in over 275 ms after 20 ms on expand, same curve | measured |
A recipe that follows it: one fraction, driven by user scroll only, with the collapse and expand distances above. Compose's
NestedScrollSource.UserInput does not tell a finger from a mouse wheel or the keyboard, so on those inputs the recipe
responds too; excluding fling and programmatic scroll is what it shares with the take.
@Composable
fun rememberBarCollapse(): Triple<State<Float>, State<Float>, NestedScrollConnection> {
var collapsed by remember { mutableStateOf(false) }
// One event's delta is small: movement is summed in the current direction, and the sum is reset when it turns.
var travel by remember { mutableFloatStateOf(0f) }
val density = LocalDensity.current
val collapseAt = with(density) { 36.dp.toPx() } // fitted to the take's commits (+23 to +45 pt)
val expandAt = with(density) { 72.dp.toPx() } // fitted (70 to 78 pt)
val fraction = animateFloatAsState(
targetValue = if (collapsed) 1f else 0f,
// iOS's default view curve over 325 ms, fitted to the take (1 % to 99 % in 270 to 286 ms).
animationSpec = tween(durationMillis = 325, easing = CubicBezierEasing(0.25f, 0.1f, 0.25f, 1f)),
label = "barCollapse",
)
// The side buttons fade on their own clock: out over 180 ms on collapse, in over 275 ms after 20 ms on expand.
val buttonAlpha = animateFloatAsState(
targetValue = if (collapsed) 0f else 1f,
animationSpec = if (collapsed) {
tween(durationMillis = 180, easing = CubicBezierEasing(0.25f, 0.1f, 0.25f, 1f))
} else {
tween(durationMillis = 275, delayMillis = 20, easing = CubicBezierEasing(0.25f, 0.1f, 0.25f, 1f))
},
label = "barButtons",
)
val connection = remember(collapseAt, expandAt) {
object : NestedScrollConnection {
override fun onPreScroll(available: Offset, source: NestedScrollSource): Offset {
val dy = available.y
if (dy == 0f || source != NestedScrollSource.UserInput) return Offset.Zero // user scroll only
travel = if (travel == 0f || (dy < 0f) == (travel < 0f)) travel + dy else dy
if (!collapsed && travel < -collapseAt) { collapsed = true; travel = 0f } // content scrolling down
if (collapsed && travel > expandAt) { collapsed = false; travel = 0f }
return Offset.Zero
}
}
}
return Triple(fraction, buttonAlpha, connection)
}
Read fraction.value and buttonAlpha.value inside Modifier.layout or graphicsLayer (so scrolling does not
recompose), and lerp the capsule's width and the bar's offset with the fraction; the side buttons' alpha is buttonAlpha. For the glass itself to morph rather than cross-fade,
draw the compact and full capsules as one glassEffectID in a GlassEffectContainer
(see Interaction).
The trigger distances and the easing are fitted to the decoded take (36 pt and 72 pt, the cubic-bezier curve); that the
recipe applies them with dp and Compose's tween is authored. No app-owned render or capture of this recipe is published:
the numbers come from a private recording, so there is no visual evidence under review/ for it, and the scroll-edge
report above covers GlassScrollEdge, not this bar. The timing is not asserted by a test: the recording fixes it only to +-3 frames, which is wider than one frame.