iOS — Liquid Glass
JS behaviour
Context menu
Long-press or right-click: the card swells and fades, the backdrop takes a liquid blur and the menu of tinted-icon actions rises; releasing outside the menu cancels.
Real scenarios
The component as it is used in a product — not a specimen grid.
Press and hold — the menu surfaces
Long-press the photo for half a second, right-click it, or just click it (a plain click opens the menu too, so keyboards work): the card swells and softens, the whole backdrop takes a liquid blur, and the glass menu rises with tinted actions. Releasing outside the menu — or pressing elsewhere, or Escape — cancels.
Travel Gallery
Caspian trip · autumn 1404
…
Important props
| Prop | Type | Default | What it does |
|---|---|---|---|
| preview | style | 'lift + blur' | The target lifts, scales slightly and blurs; the backdrop saturates. |
| trigger | events | 'press · right-click' | A 500ms long-press or right-click; both show the preview. |
| items | rows | 'icon + label' | Each row a tinted icon + label; destructive in red, separated. |
Snippet
<div class="ioctx" oncontextmenu="ioctxOpen(event)">
<img src="card.png" alt="">
<menu class="ioctx-menu">
<button><span style="--tint:#34C759">⬆︎</span> اشتراکگذاری</button>
<button data-destructive>حذف</button>
</menu>
</div>
<style>
.ioctx[data-open] { scale: 1.05; filter: blur(2px); opacity: .9; }
.ioctx-menu { position: absolute; inset-block-start: calc(100% + 8px); inline-size: 250px;
padding: 6px; border-radius: 13px; background: #f0f0f0e6;
backdrop-filter: blur(40px); box-shadow: 0 10px 40px #0000003d; }
.ioctx-menu button { display: flex; gap: 10px; align-items: center; block-size: 44px; }
</style>