Charts
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 Sunburst(
inner: List<Pair<Float, Color>> = listOf(
0.4f to Color(0xFF6366F1), 0.35f to Color(0xFF10B981), 0.25f to Color(0xFFF59E0B),
),
outer: List<Float> = listOf(0.22f, 0.18f, 0.2f, 0.15f, 0.13f, 0.12f),
modifier: Modifier = Modifier,
) {
val sweep by animateFloatAsState(1f, tween(1000, easing = EaseOutCubic), label = "s")
val hub = MaterialTheme.colorScheme.surface
Canvas(modifier.size(150.dp)) {
val rIn = size.minDimension * 0.28f
val rOut = size.minDimension * 0.46f
var a = -90f
inner.forEach { (f, c) ->
val deg = 360f * f
drawArc(c, a, deg * sweep, true, topLeft = center - Offset(rIn, rIn), size = Size(rIn * 2, rIn * 2))
a += deg
}
a = -90f
outer.forEachIndexed { i, f ->
val deg = 360f * f
drawArc(
inner[i % inner.size].second.copy(alpha = 0.55f),
a, deg * sweep, true,
topLeft = center - Offset(rOut, rOut), size = Size(rOut * 2, rOut * 2),
)
a += deg
}
drawCircle(hub, rIn * 0.45f, center)
}
}