Glass renders the iOS "liquid glass" material - a translucent, frosted surface with a backdrop blur and subtle inner highlights. It is the same background used under the hood by components like Navbar, Toolbar, Tabbar and Popover, and is now exported so you can build your own glass-styled surfaces.
Any content passed to Glass is rendered inside the glass surface. By default it renders a <div>, which can be changed with the component prop:
<script>
import { Glass } from 'konsta/svelte';
</script>
<Glass class="rounded-2xl p-4">Liquid Glass</Glass>
The glass effect is only rendered in the iOS theme. In the
Material theme Glass renders as a plain element without any
extra styling.
There are following components included:
Glass| Name | Type | Default | Description |
|---|---|---|---|
| colors | object | Object with Tailwind CSS colors classes | |
| colors.bgIos | string | 'bg-ios-light-glass dark:bg-ios-dark-glass' | |
| colors.shadowIos | string | 'shadow-ios-light-glass dark:shadow-ios-dark-glass' | |
| highlight | boolean | true | Enables iOS "liquid glass" hover highlight effect on pointer move (iOS theme only) |