Experiments

Map Sheet

A glass sheet over a map that drags between three heights, with everything behind it following the drag

October 1, 2026

Weekend in Lisbon

Save the area around your hotel so directions work without data.

Save offline map

Suggestions

Parked car

Near the bakery, 3 min walk

Recents

  • Home

    Linden Street 4

  • Studio

    River Street 21

  • Bakery on the corner

    Market Lane 7

Drag the sheet, or the map behind it

The sheet from the maps app on an iPhone: a pane of glass floating over the map, dragged between three heights. It isn't a panel that animates between states once you let go. Everything that changes is read from the sheet's position while your finger is still down. That covers the gap to the screen edge, the corners, the glass getting more opaque, the map dimming and the buttons riding above it. So it tracks the drag exactly, and reverses with it.

I built it together with an AI agent, working from a screenshot. The full code is at the end.

What went wrong first

The glass looked like Tupperware. It was a heavy frost, an 18px blur under a 30% white tint, and it read as plastic, not glass at all. I spotted it and pushed back, and the fix is in the glass section below. The other two problems, the saturation and a jump when the sheet scrolled into view, got the same treatment. I looked, saw what was wrong, and told the agent.

The detents

The three heights are what the Human Interface Guidelines call detents1. Large fills the screen, medium is half of it, as the guidelines define it, and small shrinks the sheet to a pill around the search field. Tapping the grabber cycles through them too, which the guidelines ask of it.

When you let go, the sheet goes to the detent nearest to where the flick would have landed, not to where your finger stopped. That landing point is the velocity projected with UIScrollView's deceleration rate, (v / 1000) * 0.998 / (1 - 0.998). I first saw the formula in Rauno's course, and it comes from the Designing Fluid Interfaces talk2. A short, fast flick can carry past the nearest detent, which is how the real one behaves and exactly what a nearest-to-the-finger rule gets wrong.

The geometry, in two legs

Between large and medium, the gap to the edge grows from 0 to 9px. The corner shrinks from 53px, the screen's own, to 44px, so the sheet's curve stays concentric with the screen's. Between medium and small, the gap keeps growing to 22px, which lines the pill up with the outer edge of the map buttons. The corner closes to half the pill's height.

The corners are squircles, and a squircle at half the height of a pill pinches its ends. So the corner-shape eases from superellipse(2) to superellipse(1) on the same leg.

Why the sheet can't be scaled

Scaling would stretch the copy inside the sheet. So the glass animates its real left, right and height and clips. The content keeps a fixed width of calc(100cqw - 18px) and gets shifted back by exactly as much as the glass moved in. Nothing rewraps mid-drag. The only thing that takes up the extra room is the search field row, which is a flex row and doesn't care.

One more thing came up along the way. The map and the sheet jumped up inside the phone the moment the sheet was scrolled into view. overflow: hidden still lets the browser scroll an element to bring something inside it into view, and the sheet hanging below the phone gave it room to. overflow: clip doesn't.

The glass

What makes it read as glass is light, not frost. It is an 8px blur, a bright rim along the top-left edge and a fainter one on the bottom-right where the light leaves, and a soft glow inside the edge that reads as the thickness of the material. I tuned the blur and the saturation myself. Pushing the saturation to 2 to get the colour to bloom through turned the beige map yellow, so it sits at 1.4.

The cards inside the sheet are plain fills rather than more glass, since the guidelines keep Liquid Glass for the controls layer and out of the content3.

What's missing is the refraction at the edges, where the real thing bends the map. A browser can only do that with an SVG filter in backdrop-filter, which only Chromium supports, against a sheet that changes size on every frame.

The map drags too

The map moves by 60px in any direction, with Motion's drag4 and a little elastic past the limit. It's a small thing, but a map that doesn't move under your finger reads as a picture of a map.

If you're about to build one

The grabber is a real button, so the keyboard and screen readers can move the sheet between detents without dragging anything. On a phone, a vertical swipe over the map still scrolls the page, since the phone is taller than most screens and trapping the scroll there would be worse than not panning. If you prefer reduced motion, the sheet jumps straight to its detent and the map stops where you let go of it instead of gliding.

The code

MapArt is the decorative map behind the sheet, so it is not listed.

MapSheet.tsx

"use client"
import {
BatteryFullIcon,
BinocularsIcon,
BreadIcon,
CarProfileIcon,
CellSignalFullIcon,
DotsThreeIcon,
HouseIcon,
MagnifyingGlassIcon,
MapTrifoldIcon,
MicrophoneIcon,
NavigationArrowIcon,
PaintBrushIcon,
WifiHighIcon,
XIcon,
} from "@phosphor-icons/react"
import {
animate,
type MotionStyle,
motion,
useMotionValue,
useReducedMotion,
useTransform,
} from "motion/react"
import { MapArt } from "./MapArt"
import { useMapSheetTuning } from "./tuning"
const STAGE_HEIGHT = 740
const STAGE_RADIUS = 53
const GAP = 9
// how far the map pans past the screen before it stops
const MAP_PAN = 60
// collapsed, the sheet's sides line up with the outer edges of the map controls, and its bottom
// keeps the same gap
const PILL_INSET = 22
const PILL_HEIGHT = 64
// the search row with the sheet's own 15px above and below it
const ROW_HEIGHT = 72
// the top of the sheet at full height, clear of the status bar
const TOP = 54
const SHEET = STAGE_HEIGHT - TOP
// the three detents, as how far the sheet has been pulled down from full height; medium is half of
// full, as the HIG defines it, and small leaves the search row
const LARGE = 0
const MEDIUM = SHEET / 2
const SMALL = SHEET - PILL_INSET - PILL_HEIGHT
const DETENTS = [LARGE, MEDIUM, SMALL]
// the glass stays clear enough to read the map through, and gets its body from light rather than
// frost: a specular rim on the top-left edge, a fainter one on the bottom-right where light leaves it,
// and a soft glow inside the edge that reads as the thickness of the material
const GLASS =
"backdrop-blur-[8px] backdrop-saturate-[1.4] backdrop-brightness-[1.06] shadow-[inset_1.5px_1.5px_1px_-1px_oklch(1_0_0/0.95),inset_-1.5px_-1.5px_1px_-1px_oklch(1_0_0/0.6),inset_0_0_0_0.5px_oklch(1_0_0/0.5),inset_0_0_18px_oklch(1_0_0/0.35),0_0_0_0.5px_oklch(0_0_0/0.06),0_10px_36px_oklch(0_0_0/0.16)] dark:backdrop-brightness-[0.9] dark:shadow-[inset_1.5px_1.5px_1px_-1px_oklch(1_0_0/0.5),inset_-1.5px_-1.5px_1px_-1px_oklch(1_0_0/0.22),inset_0_0_0_0.5px_oklch(1_0_0/0.14),inset_0_0_18px_oklch(1_0_0/0.07),0_10px_36px_oklch(0_0_0/0.5)]"
const FILL = "bg-white/45 dark:bg-white/[0.08]"
const CONTROL = `bg-white/25 text-neutral-800 dark:bg-white/[0.08] dark:text-white ${GLASS}`
const RECENTS = [
{ icon: HouseIcon, title: "Home", detail: "Linden Street 4" },
{ icon: PaintBrushIcon, title: "Studio", detail: "River Street 21" },
{ icon: BreadIcon, title: "Bakery on the corner", detail: "Market Lane 7" },
]
/** where a flick would come to rest if nothing stopped it, as UIScrollView projects it */
function project(velocity: number, deceleration: number) {
return ((velocity / 1000) * deceleration) / (1 - deceleration)
}
/**
* A map with a floating glass sheet on three detents. The sheet's position drives everything else
* while the finger is down: the map controls ride above it and fade on the way to full height, the
* gap to the edges closes, the corners open out to the screen's own, and the glass turns opaque.
*/
export function MapSheet() {
const { deceleration, settle: spring } = useMapSheetTuning()
const reduced = useReducedMotion()
const y = useMotionValue(MEDIUM)
// the glass resizes for real and clips, while the content keeps its width and place, so the copy
// never rewraps mid-drag
const inset = useTransform(y, [LARGE, MEDIUM, SMALL], [0, GAP, PILL_INSET])
const height = useTransform(() => SHEET - y.get() - inset.get())
// concentric with the screen down to medium: the sheet's corner plus the gap is the screen's
// corner. Below it the sheet closes into a pill, so the corner also eases from squircle to round,
// since a squircle at half the height deforms the pill's ends
const radius = useTransform(
y,
[LARGE, MEDIUM, SMALL],
[STAGE_RADIUS, STAGE_RADIUS - GAP, PILL_HEIGHT / 2],
)
const cornerShape = useTransform(y, [MEDIUM, SMALL], [2, 1])
const contentX = useTransform(inset, (value) => GAP - value)
// the search row alone takes up the extra inset, so the cards below never rewrap
const rowInset = useTransform(inset, (value) => Math.max(0, value - GAP))
// and rises to stay centred in the shorter pill
const rowY = useTransform(y, [MEDIUM, SMALL], [0, -(ROW_HEIGHT - PILL_HEIGHT) / 2])
// the grabber rises further, to keep clear of the row
const grabberY = useTransform(y, [MEDIUM, SMALL], [0, -2])
const tint = useTransform(y, [LARGE, MEDIUM], [0.92, 0.12])
const dim = useTransform(y, [LARGE, MEDIUM], [0.3, 0])
const controlsY = useTransform(y, (value) => value - MEDIUM)
const controls = useTransform(y, [MEDIUM * 0.5, MEDIUM], [0, 1])
function settle(target: number, velocity = 0) {
animate(y, target, reduced ? { duration: 0 } : { type: "spring", ...spring, velocity })
}
function nearestDetent(position: number) {
return DETENTS.reduce((best, detent) =>
Math.abs(detent - position) < Math.abs(best - position) ? detent : best,
)
}
// a tap on the grabber cycles through the detents, as the HIG asks of it
function stepDetent() {
const index = DETENTS.indexOf(nearestDetent(y.get()))
settle(DETENTS[(index + DETENTS.length - 1) % DETENTS.length])
}
return (
<>
<div
style={{ height: STAGE_HEIGHT, borderRadius: STAGE_RADIUS }}
className={
"corner-squircle relative w-full max-w-[360px] overflow-clip bg-neutral-100 text-neutral-900 shadow-card dark:bg-neutral-900 dark:text-white"
}
>
{/* the map pans a little past the screen and springs back, enough to feel like a map
rather than a picture of one */}
<motion.div
aria-hidden={"true"}
drag
dragConstraints={{ top: -MAP_PAN, right: MAP_PAN, bottom: MAP_PAN, left: -MAP_PAN }}
dragElastic={0.12}
dragMomentum={!reduced}
dragTransition={{
power: 0.2,
timeConstant: 200,
bounceStiffness: 400,
bounceDamping: 40,
}}
// on a phone a vertical swipe over the map still scrolls the page, since the stage is taller
// than most screens; sideways drags pan the map
style={{ inset: -MAP_PAN, touchAction: "pan-y" }}
className={"absolute cursor-grab active:cursor-grabbing"}
>
<MapArt />
<div className={"absolute top-[356px] left-[262px]"}>
<span
className={
"-translate-1/2 mask-radial-from-10% mask-radial-to-50% absolute top-0 left-0 size-24 -rotate-60 bg-[conic-gradient(from_-28deg,oklch(0.62_0.19_252/0.55)_0deg_56deg,transparent_56deg)]"
}
/>
<span
className={
"-translate-1/2 relative block size-[15px] rounded-full bg-[#0a84ff] shadow-[0_0_0_3.5px_white,0_1px_6px_3.5px_oklch(0_0_0/0.25)]"
}
/>
</div>
</motion.div>
<motion.div
aria-hidden={"true"}
style={{ opacity: dim }}
className={"pointer-events-none absolute inset-0 bg-black"}
/>
<div
aria-hidden={"true"}
className={
"pointer-events-none absolute inset-x-0 top-0 flex h-[50px] items-center justify-between px-[42px] pt-1 font-semibold text-[16px] text-neutral-900 dark:text-white"
}
>
<span className={"tabular-nums"}>9:41</span>
<span className={"flex items-center gap-1.5"}>
<CellSignalFullIcon size={17} weight={"fill"} />
<WifiHighIcon size={17} weight={"bold"} />
<BatteryFullIcon size={24} weight={"fill"} />
</span>
</div>
<motion.div
style={{ y: controlsY, opacity: controls, top: TOP + MEDIUM - 17 - 104 }}
className={"pointer-events-none absolute inset-x-[22px] flex items-end justify-between"}
>
<div className={"pointer-events-auto flex flex-col gap-[10px]"}>
<button
type={"button"}
aria-label={"3D view"}
className={`grid size-[47px] cursor-pointer place-items-center rounded-full font-semibold text-[17px] ${CONTROL}`}
>
3D
</button>
<button
type={"button"}
aria-label={"Look around"}
className={`grid size-[47px] cursor-pointer place-items-center rounded-full ${CONTROL}`}
>
<BinocularsIcon size={22} weight={"fill"} />
</button>
</div>
<div className={`pointer-events-auto flex w-[47px] flex-col rounded-full ${CONTROL}`}>
<button
type={"button"}
aria-label={"Driving directions"}
className={"grid h-[52px] cursor-pointer place-items-center"}
>
<CarProfileIcon size={24} weight={"fill"} />
</button>
<button
type={"button"}
aria-label={"Show my location"}
className={"grid h-[52px] cursor-pointer place-items-center"}
>
<NavigationArrowIcon size={21} className={"-scale-x-100"} />
</button>
</div>
</motion.div>
<motion.section
aria-label={"Search and places"}
drag={"y"}
dragConstraints={{ top: LARGE, bottom: SMALL }}
dragElastic={0.08}
dragMomentum={false}
style={{ y, top: TOP, height: SHEET }}
onDragEnd={(_, { velocity }) => {
// the detent nearest to where the flick would land, so a short flick still travels
const landing = y.get() + project(velocity.y, deceleration)
settle(nearestDetent(landing), velocity.y)
}}
className={"@container absolute inset-x-0 touch-none"}
>
<motion.div
style={
{
left: inset,
right: inset,
height,
borderRadius: radius,
"--corner": cornerShape,
} as MotionStyle
}
className={`absolute top-0 overflow-hidden [corner-shape:superellipse(var(--corner))] ${GLASS}`}
>
<motion.div
aria-hidden={"true"}
style={{ opacity: tint }}
className={"absolute inset-0 bg-white dark:bg-[#1c1c1e]"}
/>
<button
type={"button"}
aria-label={"Resize the sheet"}
onClick={stepDetent}
className={
"absolute inset-x-0 top-0 z-10 flex h-[15px] cursor-grab justify-center pt-[5px] outline-none active:cursor-grabbing"
}
>
<motion.span
style={{ y: grabberY }}
className={"h-1 w-14 rounded-full bg-black/20 dark:bg-white/30"}
/>
</button>
<motion.div
style={{ x: contentX, width: `calc(100cqw - ${GAP * 2}px)` }}
className={"relative px-[15px] pt-[15px] text-neutral-900 dark:text-white"}
>
<motion.div
style={{ paddingLeft: rowInset, paddingRight: rowInset, y: rowY }}
className={"flex items-center gap-2"}
>
<label
className={`flex h-10 min-w-0 flex-1 items-center gap-[7px] rounded-full pr-3.5 pl-[11px] ${FILL}`}
>
<MagnifyingGlassIcon
size={20}
weight={"bold"}
className={"shrink-0 opacity-60"}
/>
<input
type={"search"}
placeholder={"Search Maps"}
aria-label={"Search Maps"}
className={
"min-w-0 flex-1 bg-transparent text-[17px] outline-none placeholder:text-neutral-900/50 dark:placeholder:text-white/55"
}
/>
<MicrophoneIcon size={20} className={"shrink-0 opacity-60"} />
</label>
<span
aria-hidden={"true"}
className={
"grid size-[42px] shrink-0 place-items-center rounded-full bg-gradient-to-br from-sky-400 to-indigo-500 font-semibold text-[17px] text-white"
}
>
P
</span>
</motion.div>
<div className={`corner-squircle mt-[22px] rounded-[22px] ${FILL}`}>
<div className={"flex items-center gap-[19px] py-[17px] pr-4 pl-[17px]"}>
<span
className={
"grid size-7 shrink-0 place-items-center rounded-full bg-[#5ac8fa] text-white"
}
>
<MapTrifoldIcon size={16} weight={"fill"} />
</span>
<div className={"min-w-0 flex-1"}>
<p className={"font-semibold text-[17px] leading-[22px]"}>Weekend in Lisbon</p>
<p className={"text-[15px] leading-5 opacity-60"}>
Save the area around your hotel so directions work without data.
</p>
</div>
<XIcon size={16} weight={"bold"} className={"shrink-0 self-start opacity-50"} />
</div>
<p
className={
"ml-16 border-black/10 border-t py-[14px] text-[#0a84ff] text-[17px] dark:border-white/10 dark:text-[#5ac8fa]"
}
>
Save offline map
</p>
</div>
<p className={"mt-[26px] mb-2.5 pl-1 font-bold text-[22px] leading-7"}>Suggestions</p>
<div
className={`corner-squircle flex h-[65px] items-center gap-3 rounded-[20px] px-[15px] ${FILL}`}
>
<span
className={
"grid size-[31px] shrink-0 place-items-center rounded-full bg-gradient-to-b from-[#3d9bff] to-[#0a6cff] text-white"
}
>
<CarProfileIcon size={17} weight={"fill"} />
</span>
<div className={"min-w-0 flex-1"}>
<p className={"font-semibold text-[17px] leading-[22px]"}>Parked car</p>
<p className={"truncate text-[15px] leading-5 opacity-60"}>
Near the bakery, 3 min walk
</p>
</div>
<DotsThreeIcon size={22} weight={"bold"} className={"shrink-0 opacity-70"} />
</div>
<p className={"mt-[26px] mb-2.5 pl-1 font-bold text-[22px] leading-7"}>Recents</p>
<ul className={`corner-squircle overflow-hidden rounded-[20px] ${FILL}`}>
{RECENTS.map(({ icon: Icon, title, detail }) => (
<li
key={title}
className={"group/row flex h-[62px] items-center gap-3 pl-[15px]"}
>
<span
className={
"grid size-[31px] shrink-0 place-items-center rounded-full bg-black/[0.07] dark:bg-white/15"
}
>
<Icon size={16} weight={"fill"} />
</span>
<div
className={
"flex h-full min-w-0 flex-1 flex-col justify-center border-black/10 border-b pr-[15px] group-last/row:border-b-0 dark:border-white/10"
}
>
<p className={"font-semibold text-[17px] leading-[22px]"}>{title}</p>
<p className={"truncate text-[15px] leading-5 opacity-60"}>{detail}</p>
</div>
</li>
))}
</ul>
</motion.div>
</motion.div>
</motion.section>
</div>
</>
)
}

tuning.ts

"use client"
import { createContext, useContext } from "react"
/**
* The numbers the sheet runs on. The published component reads these defaults; `/lab` is the only
* caller that replaces them, with DialKit.
*/
export interface MapSheetTuning {
/** UIScrollView's deceleration rate, for projecting where a flick would land */
deceleration: number
/** the sheet settling on a detent, carrying the velocity it was let go with */
settle: { duration: number; bounce: number }
}
export const MAP_SHEET_TUNING: MapSheetTuning = {
deceleration: 0.998,
settle: { duration: 0.45, bounce: 0.15 },
}
const MapSheetTuningContext = createContext(MAP_SHEET_TUNING)
export const MapSheetTuningProvider = MapSheetTuningContext.Provider
export function useMapSheetTuning() {
return useContext(MapSheetTuningContext)
}

References

  1. 1.Sheets · Human Interface Guidelines · Apple
  2. 2.Designing Fluid Interfaces · WWDC 2018 · Apple
  3. 3.Materials · Human Interface Guidelines · Apple
  4. 4.Drag gestures · Motion

Would you like to see more of this?

One email each time a new experiment is published.

Next experiment

Squircle

The continuous-curve corner, from a single SVG filter