@zakisheriff/liquid-glass 0.3.3 → 0.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -6,8 +6,8 @@
6
6
  <br />
7
7
 
8
8
  [![npm version](https://img.shields.io/npm/v/@zakisheriff/liquid-glass?style=for-the-badge&logo=npm&color=cb3837)](https://www.npmjs.com/package/@zakisheriff/liquid-glass)
9
- [![Total npm downloads](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fapi.npmjs.org%2Fdownloads%2Fpoint%2F2026-05-31%3A2100-01-01%2F%40zakisheriff%2Fliquid-glass&query=%24.downloads&label=total%20downloads&style=for-the-badge&color=0a84ff)](https://www.npmjs.com/package/@zakisheriff/liquid-glass)
10
- [![Bundle size](https://img.shields.io/bundlephobia/minzip/@zakisheriff/liquid-glass?style=for-the-badge&label=gzip&color=30d158)](https://bundlephobia.com/package/@zakisheriff/liquid-glass)
9
+ [![Total npm downloads](https://badgen.net/npm/dt/@zakisheriff/liquid-glass?label=total%20downloads&color=0a84ff&scale=1.25)](https://www.npmjs.com/package/@zakisheriff/liquid-glass)
10
+ [![Bundle size](https://img.shields.io/badge/gzip-36_kB-30d158?style=for-the-badge)](https://www.npmjs.com/package/@zakisheriff/liquid-glass?activeTab=code)
11
11
  [![Zero dependencies](https://img.shields.io/badge/dependencies-0-30d158?style=for-the-badge)](https://www.npmjs.com/package/@zakisheriff/liquid-glass?activeTab=dependencies)
12
12
  <br />
13
13
  ![React](https://img.shields.io/badge/React-%3E%3D17-61dafb?style=for-the-badge&logo=react&logoColor=white)
@@ -18,10 +18,18 @@
18
18
  <br />
19
19
 
20
20
  [![Live demo](https://img.shields.io/badge/Live_demo-liquidglass.theatom.lk-0a84ff?style=for-the-badge&logo=safari&logoColor=white)](https://liquidglass.theatom.lk)
21
+ [![Demo video](https://img.shields.io/badge/Demo_video-watch-ff375f?style=for-the-badge&logo=airplayvideo&logoColor=white)](https://liquidglass.theatom.lk/docs#demo)
21
22
  [![Docs](https://img.shields.io/badge/Docs-read-1d1d1f?style=for-the-badge&logo=readthedocs&logoColor=white)](https://liquidglass.theatom.lk/docs)
22
23
  [![npm](https://img.shields.io/badge/npm-install-cb3837?style=for-the-badge&logo=npm&logoColor=white)](https://www.npmjs.com/package/@zakisheriff/liquid-glass)
23
24
  [![GitHub](https://img.shields.io/badge/GitHub-star-181717?style=for-the-badge&logo=github&logoColor=white)](https://github.com/zakisheriff/Liquid-Glass)
24
25
 
26
+ <br />
27
+ <br />
28
+
29
+ <a href="https://liquidglass.theatom.lk/docs#demo"><img src="https://raw.githubusercontent.com/zakisheriff/Liquid-Glass/main/.github/demo-cover.webp" alt="Liquid Glass playground: buttons, sliders, switches, tab bar, menu and sheet. Click to watch the demo video." width="100%" /></a>
30
+
31
+ **[▶ Click to watch the demo video](https://liquidglass.theatom.lk/docs#demo)**
32
+
25
33
  </div>
26
34
 
27
35
  ---
@@ -49,93 +57,474 @@ Works with Next.js (the bundle is marked `"use client"`), Vite and CRA.
49
57
 
50
58
  ## Components
51
59
 
52
- | Component | What it does |
53
- | --- | --- |
54
- | `GlassButton` | Pill or circle (`icon` with no children). Swells, leans toward a drag, wobbles on release. |
55
- | `GlassSwitch` | The knob lifts into a clear lens that refracts the track. Tap, or drag with rubber-banding. |
56
- | `GlassNav` | Floating tab bar. The selection inflates into a lens you can drag across tabs. Icons with labels, or icons only. |
57
- | `GlassSegmented` | Segmented control. The whole control swells and the selection becomes a draggable lens. |
58
- | `GlassSlider` | Thin track with a lens thumb that magnifies the rail, or `showThumb={false}` for a Control Center block. |
59
- | `GlassInput` | Search / text field with icon, trailing accessory and clear button. |
60
- | `GlassCard` | Refracting panel, `regular` or `clear`. |
61
- | `GlassMenu` | Pull-down menu that grows out of its glass button and folds back into it. Slide a finger across the items to pick one. |
62
- | `GlassSheet` | Floating bottom sheet. Spring entrance, drag or flick to dismiss. With `detents` it opens at half height and expands to full screen. |
60
+ | Component | Import | What it does |
61
+ | --- | --- | --- |
62
+ | [Button](#button--glassbutton) | `GlassButton` | Pill or circle. Swells, leans toward a drag, wobbles on release. |
63
+ | [Toggle Switch](#toggle-switch--glassswitch) | `GlassSwitch` | The knob lifts into a clear lens that refracts the track. Tap, or drag with rubber-banding. |
64
+ | [Slider](#slider--glassslider) | `GlassSlider` | Thin track with a lens thumb, or a Control Center block. |
65
+ | [Segmented Control](#segmented-control--glasssegmented) | `GlassSegmented` | The control swells and the selection becomes a draggable lens. |
66
+ | [Tab Bar](#tab-bar--glassnav) | `GlassNav` | Floating tab bar. The selection inflates into a lens you can drag across tabs. |
67
+ | [Menu](#menu--glassmenu) | `GlassMenu` | Pull-down menu that grows out of its glass button and folds back into it. |
68
+ | [Search and Text Field](#search-and-text-field--glassinput) | `GlassInput` | Text or search field with icon, trailing accessory and clear button. |
69
+ | [Card](#card--glasscard) | `GlassCard` | Refracting panel, frosted or clear. |
70
+ | [Sheet](#sheet--glasssheet) | `GlassSheet` | Bottom sheet. Drag or flick to dismiss; with detents, half height to full screen. |
71
+
72
+ Every example below assumes `useState` from React and the stylesheet imported once. Icons such as `<PlusIcon />` stand for any React node, like an SVG icon component. `intensity` (1–10) scales refraction strength on every component.
73
+
74
+ <!-- components:start -->
75
+ ### Button · `GlassButton`
76
+
77
+ A pill, or a circle when it has an icon and no label. It swells under the finger, leans toward a drag and wobbles as it settles.
78
+
79
+ **Variants**
80
+
81
+ ```tsx
82
+ import { GlassButton } from '@zakisheriff/liquid-glass';
83
+
84
+ <GlassButton>Glass</GlassButton>
85
+ <GlassButton variant="clear">Clear</GlassButton>
86
+ <GlassButton variant="tinted">Tinted</GlassButton>
87
+ <GlassButton variant="filled">Filled</GlassButton>
88
+ <GlassButton variant="tinted-filled" tint="#af52de">Tinted filled</GlassButton>
89
+ ```
90
+
91
+ **Any colour**
92
+
93
+ ```tsx
94
+ <GlassButton variant="tinted" tint="#c2255c">Burgundy label</GlassButton>
95
+ <GlassButton variant="filled" tint="#af52de">Purple fill</GlassButton>
96
+ ```
97
+
98
+ **Destructive**
99
+
100
+ ```tsx
101
+ <GlassButton destructive>Delete</GlassButton>
102
+ <GlassButton variant="filled" destructive>Delete</GlassButton>
103
+ ```
104
+
105
+ **Icons**
106
+
107
+ ```tsx
108
+ {/* Icon with a label */}
109
+ <GlassButton icon={<PlusIcon />}>New note</GlassButton>
110
+
111
+ {/* Icon only: becomes a circle, so give it an accessible name */}
112
+ <GlassButton icon={<PlusIcon />} aria-label="Add" />
113
+ ```
114
+
115
+ **Sizes**
116
+
117
+ ```tsx
118
+ <GlassButton size="sm">Small</GlassButton> {/* 36px */}
119
+ <GlassButton size="md">Medium</GlassButton> {/* 44px, default */}
120
+ <GlassButton size="lg">Large</GlassButton> {/* 52px */}
121
+ ```
122
+
123
+ **Handling clicks**
124
+
125
+ ```tsx
126
+ <GlassButton variant="filled" onClick={() => save()} disabled={saving}>
127
+ Save
128
+ </GlassButton>
129
+ ```
130
+
131
+ | Prop | Type | Default | Description |
132
+ | --- | --- | --- | --- |
133
+ | `variant` | `'glass' \| 'clear' \| 'tinted' \| 'tinted-filled' \| 'filled'` | `'glass'` | Regular glass, see-through glass, glass with a coloured label, a soft wash of the colour with a matching label, or a solid colour. |
134
+ | `tint` | `string` | `accent blue` | Any CSS colour. Colours the label for `tinted` and the fill for `filled`. |
135
+ | `destructive` | `boolean` | `false` | Red label, or a red fill with `filled`, for delete and other irreversible actions. |
136
+ | `size` | `'sm' \| 'md' \| 'lg'` | `'md'` | Height: 36, 44 or 52 px. |
137
+ | `icon` | `ReactNode` | | Leading icon. With no children the button becomes a circle. |
138
+ | `shimmer` | `boolean` | `true` | Light bloom under the finger while pressed. |
139
+ | `thickness` | `number (1–4)` | `1` | Rim bevel scale. Wider bevels bend more of the backdrop. |
140
+ | `intensity` | `number (1–10)` | `5` | Refraction strength, from subtle to heavy. |
141
+
142
+ Also accepts every `<button>` prop (`onClick`, `disabled`, `type`, `aria-*`, …).
143
+
144
+ ### Toggle Switch · `GlassSwitch`
145
+
146
+ An iOS toggle. On press the knob lifts into a clear lens that refracts the track. Tap it, or drag the knob with rubber-banding at the ends.
147
+
148
+ **Controlled**
149
+
150
+ ```tsx
151
+ import { useState } from 'react';
152
+ import { GlassSwitch } from '@zakisheriff/liquid-glass';
153
+
154
+ function WifiSetting() {
155
+ const [on, setOn] = useState(true);
156
+ return <GlassSwitch checked={on} onChange={setOn} aria-label="Wi-Fi" />;
157
+ }
158
+ ```
159
+
160
+ **Uncontrolled**
161
+
162
+ ```tsx
163
+ <GlassSwitch defaultChecked onChange={(on) => console.log(on)} aria-label="Bluetooth" />
164
+ ```
165
+
166
+ **Custom on colour**
167
+
168
+ ```tsx
169
+ <GlassSwitch checked={focus} onChange={setFocus} tint="#ff9f0a" aria-label="Focus" />
170
+ ```
171
+
172
+ **In a settings list, with a visible label**
173
+
174
+ ```tsx
175
+ <label className="setting">
176
+ <span>Live Activities</span>
177
+ <GlassSwitch checked={live} onChange={setLive} />
178
+ </label>
179
+ ```
180
+
181
+ **Disabled**
182
+
183
+ ```tsx
184
+ <GlassSwitch checked disabled aria-label="Managed by your organisation" />
185
+ ```
186
+
187
+ | Prop | Type | Default | Description |
188
+ | --- | --- | --- | --- |
189
+ | `checked` | `boolean` | | On or off, when you control the state. |
190
+ | `defaultChecked` | `boolean` | | Starting state, when the switch manages its own state. |
191
+ | `onChange` | `(checked: boolean) => void` | | Called with the new state after a tap or a drag. |
192
+ | `tint` | `string` | `system green` | On-state colour. Any CSS colour. |
193
+ | `disabled` | `boolean` | `false` | Dims the switch and ignores input. |
194
+ | `intensity` | `number (1–10)` | `5` | Refraction strength, from subtle to heavy. |
195
+
196
+ Also accepts other `<button>` props (`aria-label`, `id`, `className`, …).
197
+
198
+ The switch is a `role="switch"` button: Space and Enter toggle it. Give it an `aria-label`, or wrap it in a `<label>` with visible text.
199
+
200
+ ### Slider · `GlassSlider`
201
+
202
+ A thin iOS track whose thumb lifts into a lens that magnifies the rail, or a Control Center block that fills and stretches under the finger.
203
+
204
+ **Track with a lens thumb**
205
+
206
+ ```tsx
207
+ import { GlassSlider } from '@zakisheriff/liquid-glass';
208
+
209
+ const [volume, setVolume] = useState(40);
210
+ <GlassSlider value={volume} onChange={setVolume} aria-label="Volume" />
211
+ ```
212
+
213
+ **Control Center block**
214
+
215
+ ```tsx
216
+ <GlassSlider
217
+ showThumb={false}
218
+ value={brightness}
219
+ onChange={setBrightness}
220
+ icon={<SunIcon />}
221
+ label="Display"
222
+ />
223
+ ```
224
+
225
+ **Range, steps and colour**
226
+
227
+ ```tsx
228
+ {/* Snaps to 5 °C steps between 10 and 30 */}
229
+ <GlassSlider min={10} max={30} step={5} value={temp} onChange={setTemp} tint="#ff9f0a" aria-label="Temperature" />
230
+ ```
231
+
232
+ | Prop | Type | Default | Description |
233
+ | --- | --- | --- | --- |
234
+ | `value` | `number` | `0` | Current value. |
235
+ | `onChange` | `(value: number) => void` | | Called while dragging, with the full-precision value. |
236
+ | `min` | `number` | `0` | Lowest value. |
237
+ | `max` | `number` | `100` | Highest value. |
238
+ | `step` | `number \| 'any'` | `'any'` | Continuous by default. A number snaps to fixed increments. |
239
+ | `showThumb` | `boolean` | `true` | `true`: thin track with a lens thumb. `false`: Control Center block. |
240
+ | `icon` | `ReactNode` | | Icon inside the block slider. |
241
+ | `label` | `string` | | Label inside the block slider. Its number is rounded for display. |
242
+ | `tint` | `string` | `accent blue (white for blocks)` | Fill colour. |
243
+ | `intensity` | `number (1–10)` | `5` | Refraction strength, from subtle to heavy. |
244
+
245
+ Also accepts other `<input type="range">` props (`aria-label`, `disabled`, `name`, …).
63
246
 
64
- ### Buttons
247
+ Arrow keys, Page Up/Down, Home and End work as on a native range input.
65
248
 
66
- | Look | Code |
67
- | --- | --- |
68
- | Glass | `<GlassButton>Glass</GlassButton>` |
69
- | Filled | `<GlassButton variant="filled">Filled</GlassButton>` |
70
- | Tinted | `<GlassButton variant="tinted">Tinted</GlassButton>` |
71
- | Tinted filled | `<GlassButton variant="filled" tint="#af52de">Tinted filled</GlassButton>` |
72
- | Clear | `<GlassButton variant="clear">Clear</GlassButton>` |
73
- | Destructive | `<GlassButton destructive>Delete</GlassButton>` |
74
- | Destructive filled | `<GlassButton variant="filled" destructive>Delete</GlassButton>` |
75
- | Icon circle | `<GlassButton icon={<PlusIcon />} aria-label="Add" />` |
249
+ ### Segmented Control · `GlassSegmented`
76
250
 
77
- `tint` takes any CSS colour: it colours the label for `tinted` and the fill for `filled`. Sizes: `size="sm" | "md" | "lg"` (36 / 44 / 52 px).
251
+ A row of choices. On press the whole control swells and the selection becomes a lens you can drag between segments.
78
252
 
79
- ### Everything else
253
+ **Text segments**
80
254
 
81
255
  ```tsx
82
- <GlassSwitch checked={on} onChange={setOn} aria-label="Wi-Fi" />
83
- <GlassSwitch checked={on} onChange={setOn} tint="#ff9f0a" aria-label="Focus" />
256
+ import { GlassSegmented } from '@zakisheriff/liquid-glass';
84
257
 
258
+ const [mode, setMode] = useState(0);
259
+ <GlassSegmented options={['Chat', 'Work', 'Study']} value={mode} onChange={setMode} aria-label="Mode" />
260
+ ```
261
+
262
+ **With icons**
263
+
264
+ ```tsx
265
+ <GlassSegmented
266
+ options={[{ label: 'Light', icon: <SunIcon /> }, { label: 'Dark', icon: <MoonIcon /> }]}
267
+ value={theme}
268
+ onChange={setTheme}
269
+ aria-label="Appearance"
270
+ />
271
+ ```
272
+
273
+ **Compact**
274
+
275
+ ```tsx
276
+ <GlassSegmented size="sm" options={['Day', 'Week', 'Month']} value={range} onChange={setRange} />
277
+ ```
278
+
279
+ | Prop | Type | Default | Description |
280
+ | --- | --- | --- | --- |
281
+ | `options` | `Array<string \| { label, icon? }>` | | Segment labels, or label and icon pairs. |
282
+ | `value` | `number` | | Index of the selected segment. |
283
+ | `onChange` | `(index: number) => void` | | Called with the index of the newly selected segment. |
284
+ | `size` | `'sm' \| 'md'` | `'md'` | Height: 28 or 36 px. |
285
+ | `intensity` | `number (1–10)` | `5` | Refraction strength, from subtle to heavy. |
286
+ | `aria-label` | `string` | | Accessible name for the group. |
287
+ | `className, style` | | | Applied to the control. |
288
+
289
+ Arrow keys, Home and End move the selection.
290
+
291
+ ### Tab Bar · `GlassNav`
292
+
293
+ A floating iOS 26 tab bar. The selection inflates into a lens you can drag across the tabs. Icons with labels, or icons only.
294
+
295
+ **Icons and Labels**
296
+
297
+ ```tsx
298
+ import { GlassNav } from '@zakisheriff/liquid-glass';
299
+
300
+ const [tab, setTab] = useState(0);
85
301
  <GlassNav
86
302
  activeIndex={tab}
87
303
  onChange={setTab}
304
+ aria-label="Sections"
88
305
  items={[
89
306
  { label: 'Home', icon: <HomeIcon /> },
90
- { label: 'Library', icon: <LibraryIcon /> },
307
+ { label: 'Saved', icon: <BookmarkIcon /> },
308
+ { label: 'Library', icon: <GridIcon /> },
309
+ { label: 'Search', icon: <SearchIcon /> },
91
310
  ]}
92
311
  />
312
+ ```
93
313
 
314
+ **Icons Only**
315
+
316
+ ```tsx
317
+ {/* Labels become each tab's accessible name */}
94
318
  <GlassNav showLabels={false} activeIndex={tab} onChange={setTab} items={tabs} />
319
+ ```
320
+
321
+ **Tabs plus a separate search button**
322
+
323
+ ```tsx
324
+ <div style={{ display: 'flex', gap: 12 }}>
325
+ <GlassNav activeIndex={tab} onChange={setTab} items={tabs} />
326
+ <GlassButton icon={<SearchIcon />} aria-label="Search" size="lg" />
327
+ </div>
328
+ ```
329
+
330
+ | Prop | Type | Default | Description |
331
+ | --- | --- | --- | --- |
332
+ | `items` | `Array<{ label: string; icon?: ReactNode }>` | | The tabs. Icons sit above labels. |
333
+ | `activeIndex` | `number` | `0` | Index of the selected tab. |
334
+ | `onChange` | `(index: number) => void` | | Called when a tab is tapped, or when the lens is dragged onto one. |
335
+ | `showLabels` | `boolean` | `true` | `false` shows icons only. |
336
+ | `intensity` | `number (1–10)` | `5` | Refraction strength, from subtle to heavy. |
337
+ | `aria-label` | `string` | | Accessible name for the tab list. |
338
+ | `className, style` | | | Applied to the bar. |
339
+
340
+ Arrow keys, Home and End move between tabs. Position the bar yourself, for example `position: fixed; bottom: 24px`.
341
+
342
+ ### Menu · `GlassMenu`
343
+
344
+ A pull-down menu that grows out of its glass button and folds back into it with a jiggle. Slide a finger across the items to pick one.
345
+
346
+ **Actions**
347
+
348
+ ```tsx
349
+ import { GlassMenu } from '@zakisheriff/liquid-glass';
95
350
 
96
351
  <GlassMenu
97
352
  icon={<EllipsisIcon />}
98
353
  aria-label="More"
99
354
  items={[
100
- { label: 'View as Gallery', icon: <GridIcon />, checked: view === 'gallery', onSelect: () => setView('gallery') },
101
- { label: 'Delete', destructive: true, onSelect: remove },
355
+ { label: 'Share', icon: <ShareIcon />, onSelect: share },
356
+ { label: 'Duplicate', icon: <CopyIcon />, onSelect: duplicate },
357
+ { label: 'Delete', icon: <TrashIcon />, destructive: true, onSelect: remove },
102
358
  ]}
103
359
  />
360
+ ```
361
+
362
+ **Choices with a checkmark**
363
+
364
+ ```tsx
365
+ <GlassMenu
366
+ icon={<SortIcon />}
367
+ aria-label="Sort by"
368
+ items={['Date', 'Name', 'Size'].map((sort) => ({
369
+ label: sort,
370
+ checked: sort === current,
371
+ onSelect: () => setCurrent(sort),
372
+ }))}
373
+ />
374
+ ```
375
+
376
+ **Placement and size**
377
+
378
+ ```tsx
379
+ {/* Grows from the left edge of a small trigger, 260px wide */}
380
+ <GlassMenu icon={<EllipsisIcon />} aria-label="More" align="start" size="sm" width={260} items={items} />
381
+ ```
382
+
383
+ | Prop | Type | Default | Description |
384
+ | --- | --- | --- | --- |
385
+ | `icon` | `ReactNode` | | Icon on the trigger button, such as an ellipsis. |
386
+ | `items` | `Array<{ label, icon?, checked?, destructive?, disabled?, onSelect? }>` | | Menu rows. `checked` adds a trailing checkmark; `destructive` makes the label red. |
387
+ | `aria-label` | `string` | | Accessible name for the trigger. Required. |
388
+ | `align` | `'start' \| 'end'` | `'end'` | Edge of the trigger the menu grows from. |
389
+ | `size` | `'sm' \| 'md' \| 'lg'` | `'md'` | Trigger size, as for GlassButton. |
390
+ | `width` | `number` | `230` | Menu width in px. |
391
+ | `check` | `ReactNode` | | Replaces the trailing checkmark icon. |
392
+ | `className` | `string` | | Applied to the menu wrapper. |
393
+
394
+ Escape or a tap outside closes the menu. Arrow keys move between items.
395
+
396
+ ### Search and Text Field · `GlassInput`
397
+
398
+ A glass text field with a leading icon, an optional trailing accessory and a clear button.
399
+
400
+ **Search**
401
+
402
+ ```tsx
403
+ import { GlassInput } from '@zakisheriff/liquid-glass';
404
+
405
+ const [query, setQuery] = useState('');
406
+ <GlassInput
407
+ type="search"
408
+ placeholder="Search"
409
+ value={query}
410
+ onChange={(event) => setQuery(event.target.value)}
411
+ trailing={<MicIcon />}
412
+ aria-label="Search"
413
+ />
414
+ ```
415
+
416
+ **Text field with a label**
417
+
418
+ ```tsx
419
+ <GlassInput label="Name" placeholder="Your name" value={name} onChange={(e) => setName(e.target.value)} />
420
+ ```
421
+
422
+ **Custom icon and clear behaviour**
423
+
424
+ ```tsx
425
+ <GlassInput
426
+ icon={<MailIcon />}
427
+ type="email"
428
+ placeholder="Email"
429
+ value={email}
430
+ onChange={(e) => setEmail(e.target.value)}
431
+ onClear={() => setEmail('')}
432
+ tint="#30d158"
433
+ />
434
+ ```
104
435
 
105
- <GlassSegmented options={['Chat', 'Work']} value={mode} onChange={setMode} />
106
- <GlassSegmented size="sm" options={[{ label: 'Light', icon: <SunIcon /> }, 'Dark']} value={t} onChange={setT} />
436
+ | Prop | Type | Default | Description |
437
+ | --- | --- | --- | --- |
438
+ | `type` | `string` | `'text'` | Any input type. `'search'` adds a magnifier icon. |
439
+ | `value` | `string` | | Current text. |
440
+ | `onChange` | `(event) => void` | | Standard input change event. |
441
+ | `placeholder` | `string` | | Hint shown while empty. |
442
+ | `label` | `string` | | Small label above the field. |
443
+ | `icon` | `ReactNode` | | Leading icon. |
444
+ | `trailing` | `ReactNode` | | Trailing accessory, such as a microphone. |
445
+ | `onClear` | `() => void` | | Called by the clear button. Without it, clearing sends an empty `onChange`. |
446
+ | `tint` | `string` | | Caret and focus glow colour. |
447
+ | `intensity` | `number (1–10)` | `5` | Refraction strength, from subtle to heavy. |
107
448
 
108
- <GlassSlider value={volume} onChange={setVolume} />
109
- <GlassSlider showThumb={false} value={brightness} onChange={setBrightness} icon={<SunIcon />} label="Display" />
449
+ Also accepts every other `<input>` prop (`name`, `autoFocus`, `disabled`, …), and `ref` reaches the input.
110
450
 
111
- <GlassInput type="search" placeholder="Search" value={q} onChange={(e) => setQ(e.target.value)} trailing={<MicIcon />} />
451
+ ### Card · `GlassCard`
112
452
 
113
- <GlassCard padding="20px" radius="28px">…</GlassCard>
114
- <GlassCard variant="clear">…</GlassCard>
453
+ A refracting glass panel for grouping content and controls: frosted, or clear.
115
454
 
116
- <GlassSheet open={open} onClose={() => setOpen(false)} aria-label="Details">…</GlassSheet>
117
- <GlassSheet open={open} onClose={() => setOpen(false)} detents={['medium', 'large']} aria-label="Details">…</GlassSheet>
455
+ **Regular and clear**
456
+
457
+ ```tsx
458
+ import { GlassCard } from '@zakisheriff/liquid-glass';
459
+
460
+ <GlassCard>Frosted panel</GlassCard>
461
+ <GlassCard variant="clear">See-through panel</GlassCard>
118
462
  ```
119
463
 
120
- Sliders drag continuously by default (`step="any"`). Pass a numeric `step`, such as `step={5}`, when values should snap to fixed increments. `onChange` receives the full-precision value while block labels show a rounded number.
464
+ **Spacing, corners and tint**
465
+
466
+ ```tsx
467
+ <GlassCard padding="20px" radius="32px" tint="rgb(255 55 95 / 0.18)">
468
+ <h3>Now playing</h3>
469
+ <GlassSlider value={progress} onChange={seek} aria-label="Position" />
470
+ </GlassCard>
471
+ ```
121
472
 
122
- Pass a positioned element as a sheet's `container` to keep the sheet inside that element without locking page scrolling. Sheets use the full viewport by default.
473
+ | Prop | Type | Default | Description |
474
+ | --- | --- | --- | --- |
475
+ | `variant` | `'regular' \| 'clear'` | `'regular'` | Frosted or see-through glass. |
476
+ | `padding` | `string` | `'24px'` | Inner padding, any CSS length. |
477
+ | `radius` | `string` | `'28px'` | Corner radius, any CSS length. |
478
+ | `tint` | `string` | | CSS colour washed over the glass. |
479
+ | `thickness` | `number (1–4)` | `1` | Rim bevel scale. |
480
+ | `intensity` | `number (1–10)` | `5` | Refraction strength, from subtle to heavy. |
123
481
 
124
- ### Props reference
482
+ Also accepts every `<div>` prop (`className`, `style`, `onClick`, …).
483
+
484
+ ### Sheet · `GlassSheet`
485
+
486
+ A floating bottom sheet with a spring entrance. Drag or flick it down to dismiss. With detents it opens at half height and drags up to full screen.
487
+
488
+ **Fits its content**
489
+
490
+ ```tsx
491
+ import { GlassSheet, GlassButton } from '@zakisheriff/liquid-glass';
125
492
 
126
- | Component | Props |
127
- | --- | --- |
128
- | `GlassButton` | `variant` (`glass` · `clear` · `tinted` · `filled`), `destructive`, `tint`, `size`, `icon`, `shimmer`, `intensity`, `thickness`, plus all `<button>` props |
129
- | `GlassSwitch` | `checked`, `defaultChecked`, `onChange(checked)`, `tint`, `disabled`, `intensity` |
130
- | `GlassNav` | `items: { label, icon? }[]`, `activeIndex`, `onChange(index)`, `showLabels`, `intensity` |
131
- | `GlassMenu` | `icon`, `items: { label, icon?, checked?, destructive?, disabled?, onSelect? }[]`, `aria-label`, `align` (`end` · `start`), `size`, `width`, `check` |
132
- | `GlassSegmented` | `options: (string \| { label, icon? })[]`, `value`, `onChange(index)`, `size` (`sm` · `md`), `intensity` |
133
- | `GlassSlider` | `value`, `min`, `max`, `step`, `onChange(value)`, `showThumb`, `icon`, `label`, `tint`, `intensity` |
134
- | `GlassInput` | `type`, `value`, `onChange(event)`, `placeholder`, `label`, `icon`, `trailing`, `onClear`, `tint`, `intensity` |
135
- | `GlassCard` | `variant` (`regular` · `clear`), `padding`, `radius`, `tint`, `thickness`, `intensity` |
136
- | `GlassSheet` | `open`, `onClose()`, `detents` (`['medium', 'large']`), `container`, `tint`, `aria-label`, `intensity` |
493
+ const [open, setOpen] = useState(false);
494
+ <GlassButton onClick={() => setOpen(true)}>Details</GlassButton>
495
+ <GlassSheet open={open} onClose={() => setOpen(false)} aria-label="Details">
496
+ <p>Anything goes here.</p>
497
+ </GlassSheet>
498
+ ```
499
+
500
+ **Half height, then full screen**
501
+
502
+ ```tsx
503
+ <GlassSheet open={open} onClose={() => setOpen(false)} detents={['medium', 'large']} aria-label="Comments">
504
+ {comments}
505
+ </GlassSheet>
506
+ ```
507
+
508
+ **Inside a container**
509
+
510
+ ```tsx
511
+ {/* Stays inside a positioned element (e.g. a phone mockup) without locking page scroll */}
512
+ const [frame, setFrame] = useState<HTMLDivElement | null>(null);
513
+ <div ref={setFrame} style={{ position: 'relative', height: 600, overflow: 'hidden' }}>
514
+ <GlassSheet open={open} onClose={() => setOpen(false)} container={frame}>…</GlassSheet>
515
+ </div>
516
+ ```
137
517
 
138
- `intensity` (1–10) scales refraction strength everywhere.
518
+ | Prop | Type | Default | Description |
519
+ | --- | --- | --- | --- |
520
+ | `open` | `boolean` | | Whether the sheet is shown. |
521
+ | `onClose` | `() => void` | | Called when the scrim is tapped, Escape is pressed or the sheet is swiped down. |
522
+ | `detents` | `Array<'medium' \| 'large'>` | | Resting heights. `['medium', 'large']` opens at half height. Unset: fits its content. |
523
+ | `container` | `HTMLElement \| null` | `viewport` | Positioned element to keep the sheet inside. |
524
+ | `tint` | `string` | | CSS colour washed over the glass. |
525
+ | `aria-label` | `string` | | Accessible name for the dialog. |
526
+ | `intensity` | `number (1–10)` | `5` | Refraction strength, from subtle to heavy. |
527
+ <!-- components:end -->
139
528
 
140
529
  ## Lightweight
141
530
 
package/dist/index.css CHANGED
@@ -337,6 +337,13 @@
337
337
  .lg-button--tinted {
338
338
  color: var(--lg-tint, var(--lg-accent));
339
339
  }
340
+ .lg-button--tinted-filled {
341
+ --lg-glass-fill: color-mix(in srgb, var(--lg-tint, var(--lg-tint-default, var(--lg-accent))) 26%, var(--lg-fill));
342
+ color: var(--lg-tint, var(--lg-tint-default, var(--lg-accent)));
343
+ }
344
+ .lg-button--tinted-filled[data-pressed] {
345
+ background-color: color-mix(in srgb, var(--lg-tint, var(--lg-tint-default, var(--lg-accent))) 30%, var(--lg-fill-pressed));
346
+ }
340
347
  .lg-button[data-destructive] {
341
348
  --lg-tint-default: var(--lg-red);
342
349
  }
@@ -552,11 +559,16 @@
552
559
  left: 0;
553
560
  }
554
561
  .lg-menu.lg-glass {
555
- --lg-glass-fill: var(--lg-menu-fill);
556
- --lg-glass-blur: var(--lg-panel-blur);
562
+ --lg-glass-fill: color-mix(in srgb, var(--lg-fill) 55%, transparent);
563
+ --lg-glass-blur: 12px;
564
+ --lg-saturate: 1.9;
557
565
  position: absolute;
558
566
  inset: 0;
559
- box-shadow: 0 12px 40px rgb(0 0 0 / 0.16), inset 0 0 0 0.5px var(--lg-edge);
567
+ box-shadow:
568
+ 0 18px 44px rgb(0 0 0 / 0.18),
569
+ inset 0 0 0 0.5px rgb(255 255 255 / 0.6),
570
+ inset 0 1px 1px rgb(255 255 255 / 0.75),
571
+ inset 0 -1px 1px rgb(255 255 255 / 0.25);
560
572
  transform-origin: top right;
561
573
  transition: none;
562
574
  pointer-events: none;
@@ -818,6 +830,9 @@
818
830
  .lg-track--segmented .lg-track__item {
819
831
  color: var(--lg-fg);
820
832
  }
833
+ .lg-track--segmented .lg-nav__icon {
834
+ display: inline-flex;
835
+ }
821
836
  .lg-track--sm.lg-track--segmented {
822
837
  --lg-item-h: 28px;
823
838
  --lg-pad: 3px;