Specimens
Components
Each snippet below is the exact markup of the specimen above it. Native inputs do the work underneath, so forms, labels and keyboard support behave as usual.
S/N 0412-77 · calibrated 3 Oct 2026
ColorChecker
- Dark skin
- Light skin
- Blue sky
- Foliage
- Blue flower
- Bluish green
- Orange
- Purplish blue
- Moderate red
- Purple
Playground
Every option, live
Geometry changes (size, radius, bezel, thickness, profile, index, light, zoom) rebuild the maps. Refraction, blur, saturation and specular only change filter attributes, so they are cheap to animate.
Reference
API
Load the module once with <script type="module" src="liquid-glass.js"></script>. It
adds its styles in a cascade layer, so any unlayered CSS of yours wins.
| Option | Default | Effect |
|---|---|---|
| --lg-profile | squircle |
Bezel shape: squircle, circle, lip or concave
|
| --lg-bezel | auto | Width of the curved edge in px (auto = 0.8 × radius) |
| --lg-thickness | auto | Glass height in px (auto = 1.2 × bezel). More = stronger bend |
| --lg-ior | 1.5 | Refractive index |
| --lg-refraction | 1 | Multiplier on the physical displacement |
| --lg-blur | 1 | Frost, as a Gaussian blur in px |
| --lg-saturation | 5 | Colour boost under the rim highlight |
| --lg-specular | 0.7 | Rim highlight opacity |
| --lg-light | 225 | Light angle in degrees (0 = from the right, 90 = from below) |
| --lg-zoom | 1 | Magnification of the flat centre |
| --lg-antialias | 1 |
Smoothing of zoomed pixels, scaled to zoom and screen density. 0 turns it off,
2 doubles it
|
| Piece | Usage |
|---|---|
| glass(el, opts) |
Applies glass to any element and returns { filter, update(opts), destroy() }. Also
available as el.glass.
|
| [data-glass] |
Applied automatically, including to elements added later. Removing the attribute or the element
cleans up. The glass is drawn on the element's ::before, so keep that pseudo-element
free and avoid opacity below 1 on the element.
|
| <lg-switch> |
Attributes pass through to the inner checkbox (name, checked,
disabled…). Property .checked.
|
| <lg-slider> |
min, max, step, value, name pass
through. Property .value.
|
| <lg-stepper> |
min, max, step, value, name pass
through to a hidden <input type="number">. Hold to repeat. Property
.value.
|
| <lg-dots> |
for="id" follows a scroll-snap container's pages, or count="n". Tap, drag
to scrub, arrow keys. Property .value, fires change.
|
| <lg-segmented> |
Children are the segments. .value = selected index, fires change. Add
.lg-tabbar for icon tabs, aria-orientation="vertical" for a sidebar.
|
| <lg-picker> |
Wraps a <select>; its options are the rows. .value = selected value,
the select fires change once the wheel settles.
|
| .lg-navbar · .lg-large-title | Sticky bar with three slots (leading, title, trailing), then a large title. Scrolling turns the bar to glass and swaps the titles; no script. Follows its nearest scroller. |
| <lg-merge> |
One glass pane cut to the smooth union of its children's boxes; children closer than
--lg-merge px melt together. Follows their size and transitions; with drag
you move the children, like the lenses on the bench.
|
| <lg-magnifier> |
Wraps any content; a zoom lens follows the pointer and keyboard focus. Style
lg-magnifier .lg-lens for its size and --lg-zoom.
|
| .lg-btn | Variants .lg-round and .lg-tinted |
| .lg-toolbar |
Icon buttons sharing one capsule; add role="toolbar" and an aria-label.
<hr> divides groups; aria-pressed buttons toggle.
|
| toast(content, opts) |
Banner from the top. content is a string or node; { duration } in ms
(default 4000, 0 keeps it up). Swipe up to dismiss.
|
| [data-contextmenu] | Right-click or long-press inside opens the .lg-menu with that id at the pointer. |
| .lg-alert |
On a <dialog>. Open it with showModal() or
command="show-modal"; buttons in a <form method="dialog"> close it
with their value.
|
| .lg-sheet |
On a <dialog> opened with showModal(). Detents: half and full
height; height: auto fits the content. Give a long child overflow: auto to
scroll it; closedby="any" closes on a tap outside.
|
| .lg-tip |
On a popover="hint" element, opened by interestfor="id" on its trigger.
Sits above it, flips below when there is no room.
|
| .lg-field · .lg-panel · .lg-menu | Search field, container, popover menu |
| --lg-accent · --lg-tint | Theme colour and glass fill. Normal inherited custom properties. |