# Materials

Two materials: soft plastic (default) and Liquid Glass. Every component has a glass version: controls become clear capsules, panels and boards become regular glass, after Apple's Liquid Glass guidance. Glass looks best over colour or a picture. It works with every palette.

## Turn it on

For the whole app, or one section such as a game HUD or a hero:

```html
<html data-material="glass" data-palette="lotus">

<!-- or one section, with a warm backdrop so the glass has something to show -->
<section data-material="glass" class="cz-glass-backdrop">…</section>
```

Inside a glass page, `data-material="plastic"` turns one area back to plastic.

Glass reads best over colour or a picture. `cz-glass-backdrop` paints soft palette-coloured light; any image or scene behind works too.

## What changes

| Part | Plastic | Glass |
|---|---|---|
| Controls | Raised blocks with a wall | Clear glass capsules: a light blur, a thin bright rim and a soft floating shadow (buttons, select, tabs, toggles, checkbox, radio, calendar days) |
| Prominent actions | Coloured plastic | Tinted glass (primary, success, destructive, reward, secondary), and tinted glass badges |
| Panels and boards | Plastic boards | Regular glass: stronger blur and luminosity so text reads (cards, alerts, accordions, tables, calendar, dialogs, sheets, menus, popovers, toasts) |
| Fields | Sunken wells | Clear wells with a soft inner shadow (inputs, search, facets) |
| Press | Sinks into its wall | Swells and brightens, like a drop |

## Readable by default

- Tinted glass with light text is deepened first, dark palettes dim the glass instead of lightening it, and boards keep 72% of their colour, so every text pair passes WCAG AA in all five palettes, over the page and over the backdrop's colour pools (checked by `pnpm contrast`).
- With `prefers-reduced-transparency` or `prefers-contrast: more`, glass turns solid and the blur is off.

## Tune it

CSS:

```css
[data-material="glass"] {
  --cz-glass-fill: light-dark(rgb(255 255 255 / 0.2), rgb(12 10 20 / 0.28));
  --cz-glass-tint: 82%;   /* colour kept on tinted (prominent) glass */
  --cz-glass-board: 72%;  /* surface colour kept on dialogs, menus, sheets */
  --cz-glass-control-filter: blur(3px) saturate(1.8) brightness(1.06);
  --cz-glass-board-filter: blur(22px) saturate(1.8) brightness(1.04);
}
```

Lower values make the glass clearer but can drop text contrast; run your colours through a contrast check if you change them.

- ## Customize it for your brand Your colours, type, material and the components your product needs, tuned and contrast-checked.: [DM @_trou3 on X](https://x.com/_trou3)

Docs: https://cozy-ui.solo.engineer/docs/materials/
