iOS — Liquid Glass
JS behaviour
Search field
The iOS search field: a rounded grey pill with a magnifier that expands on focus, the Cancel button slides in from the far side, and live results drop beneath.
Real scenarios
The component as it is used in a product — not a specimen grid.
Search that makes room for itself
Tap the grey pill: it squeezes to full width, the Cancel button slides in from the far side, the round ✕ appears as soon as there is text, and the song list filters live beneath. Cancel or the ✕ puts everything back.
…
…
-
- Nothing found — try «باران» or «sea».
Important props
| Prop | Type | Default | What it does |
|---|---|---|---|
| resting | style | '#7676801f' | The system grey fill at a 10px radius. |
| cancel | button | 'slide-in' | Cancel appears only on focus and squeezes the field. |
| clear | button | '✕' | The round clear button, only while there is text. |
Snippet
<div class="iosrch">
<div class="iosrch-field">
<svg>🔍</svg><input placeholder="جستوجو">
<button class="iosrch-clear">✕</button>
</div>
<button class="iosrch-cancel">لغو</button>
</div>
<style>
.iosrch { display: flex; gap: 8px; }
.iosrch-field { flex: 1; display: flex; align-items: center; gap: 6px; block-size: 36px;
padding-inline: 8px; border-radius: 10px; background: #7676801f; }
.iosrch:focus-within .iosrch-cancel { opacity: 1; inline-size: auto; }
.iosrch-cancel { opacity: 0; inline-size: 0; overflow: hidden; color: #007AFF; }
</style>