Icons
Iconsanimated

Notification bell

A bell that swings on its pivot and emits expanding sound waves when a notification lands.

Installation

caveui components are copy-paste Jetpack Compose built entirely on Material 3 — there's no caveui dependency to add. Make sure Material 3 is on your classpath (it ships with the Compose BOM), then copy the Usage snippet below into your project.

kotlin
// build.gradle.kts (module)
dependencies {
    implementation(platform("androidx.compose:compose-bom:2025.06.00"))
    implementation("androidx.compose.material3:material3")
}

Usage

kotlin
@Composable
fun RingingBell(ringing: Boolean) {
    val swing by rememberInfiniteTransition(label = "bell").animateFloat(
        initialValue = -14f, targetValue = 14f,
        animationSpec = infiniteRepeatable(tween(180, easing = EaseInOut), RepeatMode.Reverse),
        label = "swing",
    )
    val wave by rememberInfiniteTransition(label = "wave").animateFloat(
        0f, 1f, infiniteRepeatable(tween(1200), RepeatMode.Restart), label = "w",
    )
    Box(Modifier.size(40.dp), contentAlignment = Alignment.Center) {
        if (ringing) Canvas(Modifier.matchParentSize()) {
            drawArc(
                LocalContentColor.current.copy(alpha = 1f - wave), 300f, 60f, false,
                topLeft = Offset(size.width * wave * 0.1f, 0f),
                style = Stroke(2.dp.toPx()),
            )
        }
        Icon(
            Icons.Filled.Notifications, "Notifications",
            modifier = Modifier.graphicsLayer { rotationZ = if (ringing) swing else 0f; transformOrigin = TransformOrigin(0.5f, 0f) },
        )
    }
}