Skip to content
PvotLib 1.0. Jetpack Compose.pan_tool Drag the glass. Tune it in the panel.

Liquid glass, for Android.

The design system every Pvot app is built on. Its glass is a real lens, and this is it: the shader from PvotGlass.kt, running in your browser.

implementation("com.prauga.pvot:design-system:1.0.0") code Source

The glass

Values are PvotGlassStyle's, in dp for a glass 46dp across. Intensity is LocalPvotGlassIntensity: 1 is glass, 0.1 frosted, 0 solid.

How it works

A lens, not a blur.
Four things at the rim.

01

Bend

Near the edge, the glass reads what lies just outside it and pulls it in, eased so the middle stays calm.

02

Split

Red and blue are read a little apart along the edge's normal, the fringe real glass gives.

03

Mirror

The rim reflects what sits as far outside the edge as the point is inside it, and vivid colors bleed further in.

04

Light

A soft light on the side facing the light. On the phone it follows the tilt. Here it follows your pointer.

Components

Hold them.
They turn to glass.

A few of PvotLib's components, rebuilt for the web on the same glass. The code under each is the real Compose API.

PvotNavBar

A glass bar whose chosen item grows into a pill.

PvotNavBar(
    selectedTab = tab,
    onTabClick = { tab = it },
    tabs = tabs,
)

PvotSegmentedControl

Options in a capsule, the selection sliding between them.

PvotSegmentedControl(
    options = listOf("Day", "Week", "Month"),
    selectedIndex = range,
    onSelect = { range = it },
)

PvotSlider

Hold the knob and it lifts into a lens over the track.

PvotSlider(
    value = brightness,
    onValueChange = { brightness = it },
)

PvotSwitchRow

The knob turns to glass while you hold it.

PvotSwitchRow(
    title = "Bluetooth",
    checked = on,
    onCheckedChange = { on = it },
)

PvotGlassIconButton

Round glass for an icon floating over content, like the camera's controls.

PvotGlassIconButton(onClick = flip) {
    Icon(flipIcon, "Switch camera")
}
Next up Design review at 4:30. Room 2, or join from your phone.

PvotGlassCard

A card of glass, with a rim of light that follows the tilt.

PvotGlassCard(onClick = open) {
    Text("Next up")
}
Materials

Pick the glass
by what sits on it.

The same words run behind all three. Clear lets them through, Regular softens them, Thick keeps text on top readable.

Clear

A faint haze. For icon-only controls, where nothing needs reading.

PvotGlassMaterial.Clear

Regular

A half-strength tint and a deeper blur. For bars, search fields, titled cards.

PvotGlassMaterial.Regular

Thick

Nearly opaque, the deepest blur. For sheets and dialogs with body text.

PvotGlassMaterial.Thick
Install

No account.
No token.

PvotLib is published from its own repository. Add the Maven repo, then the libraries. It builds in AOSP too, as PvotDesignSystem.

settings.gradle.kts

dependencyResolutionManagement {
    repositories {
        google()
        mavenCentral()
        maven("https://pvot-oss.github.io/PvotLib/maven") {
            content { includeGroup("com.prauga.pvot") }
        }
    }
}

Glass over your content

val backdrop = rememberPvotGlassBackdrop()
Box {
    LazyColumn(Modifier.pvotGlassBackdrop(backdrop)) { /* … */ }
    Box(
        Modifier
            .height(46.dp)
            .fillMaxWidth()
            .pvotGlass(backdrop)
            .pvotGlassRim()
    )
}