Glass
A frosted glass look for popups, panels and controls. It comes with the components, and you can adjust it from your stylesheet.
Dark popups, light panels
Popups such as menus, tooltips and toasts are dark glass in both themes, so they stand out from the page. Panels such as dialogs, cards and the header are light glass that follows your theme. Small parts like checkboxes and switches stay solid.
12 documents were re-indexed and 3 sources went stale since Monday.
12 documents were re-indexed and 3 sources went stale since Monday.
Three thicknesses
Thin glass is for chips and fields. Regular glass is for cards and floating panels. Thick glass is for anything that holds a form, like a dialog. The thicker it is, the more it hides what is behind it.
12 documents were re-indexed and 3 sources went stale since Monday.
12 documents were re-indexed and 3 sources went stale since Monday.
Use it
You get glass without doing anything, because the components already use it. For a glass button or badge over an image, pick the glass variant.
<Button variant="glass">Preview</Button>
<Badge variant="glass">4K</Badge>For a panel of your own, copy one of these.
// popup (dark in both themes)
<div className="bg-glass-background-primary text-glass-text-primary shadow-glass backdrop-glass" />
// panel
<div className="bg-glass-background-surface shadow-glass-surface backdrop-glass" />
// thick panel, for forms and dialogs
<div className="bg-glass-background-surface-thick shadow-glass-surface backdrop-glass-thick" />Backdrops
The same card over different backgrounds. Glass shows best over colour and photos. On a plain page it reads as a soft card.
12 documents were re-indexed and 3 sources went stale since Monday.
12 documents were re-indexed and 3 sources went stale since Monday.
12 documents were re-indexed and 3 sources went stale since Monday.
12 documents were re-indexed and 3 sources went stale since Monday.
12 documents were re-indexed and 3 sources went stale since Monday.
Do and don't
- Put buttons and fields on a glass panel.
- Don't put glass panels inside glass panels. It gets muddy fast. Group things with spacing, a divider or a plain fill instead.
- Give glass something to sit on, like a photo, a gradient or a coloured section.
Over dark photos
Glass buttons and badges follow the theme, so in light mode they are light. Over a dark photo that looks out of place. Add dark to the wrapper and they switch to dark glass with white text, whatever the page theme is.
<div className="dark bg-cover" style={{ backgroundImage }}>
<Button variant="glass">Preview</Button>
</div>Make it yours
Every glass value is a CSS variable in your global stylesheet. Change one and all components follow. Raise a percentage for more solid glass, or lower a blur for a clearer one.
| Token | Used for | Light | Dark |
|---|---|---|---|
--glass-background-primary | Popup fill | black 88% | black 88% |
--glass-background-primary-hover | Highlighted row in a popup | grey 8% | grey 8% |
--glass-text-primary … negative | Text inside popups | white scale | white scale |
--glass-divider | Separator inside popups | grey 8% | grey 8% |
--shadow-glass | Popup rim and drop shadow | light rim | light rim |
--glass-background-surface | Header, floating panels | white 72% | black 88% |
--glass-background-surface-thick | Dialog, alert dialog, sheet, drawer | white 84% | black 96% |
--glass-background-control | Button and Badge glass | white 60% | grey 8% |
--glass-background-control-hover | Hovered glass button | white 80% | grey 16% |
--shadow-glass-surface-value | Surface rim and drop shadow | bright top, dark hairline | faint white rim |
--shadow-glass-control-value | Control rim | bright top, dark hairline | faint white rim |
--blur-glass-thin / glass / thick | Blur radius per thickness | 12 / 24 / 40px | 12 / 24 / 40px |
Accessibility
When someone has Reduce transparency turned on in their system settings, glass becomes solid on its own. Main text stays readable on every kind of glass. The one case to watch is long grey secondary text on a light panel over a very dark photo. Add dark to the wrapper there.
Example: RAG chat
A chat screen built from three glass panels. The same markup, once over a photo and once over a gradient.
